• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC Language change on Znote AAC

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,492
Solutions
27
Reaction score
857
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi, ive founded this script for mysql, that translate the website to the language you choise..

Code:
<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: "en"
  }, "google_translate_element");
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
          </center>
        </div>

But is not looking good on the website, I would like to request, if possible, the change language function similar to this image, for Znote AAC:
znote_language.png

If more information is needed I'll be attentive to the posts.

In advance, thanks!
Regards, ralke
 
Ok it is not the best code I've done but I have a solution for you.
It will take a lot of work from you, but if you are up for it then:

add new file named localization.php containing:
PHP:
<?php
function getLocalization() {
    return json_decode('
    {
        "en": {
        "STRING_TEST_1": "English test 1",
        "STRING_TEST_2": "English test 2"
        },
        "pl": {
        "STRING_TEST_1": "Polski test 1",
        "STRING_TEST_2": "Polski test 2"
        }
    }
    ', true);
}

function getLocalizationString($string_name) {
    $localization = getLocalization();
    $language = getLocalizationLanguage();
    return $localization[$language][$string_name];
}

function setLocalizationLanguage($language) {
    $localizationCookie = "localization";
    setcookie($localizationCookie, $language, 2147483647);
}

function getLocalizationLanguage() {
    $defaultLanguage = "en";
    $localizationCookie = "localization";

    if (!isset($_COOKIE[$localizationCookie])) {
        return $defaultLanguage;
    }

    return $_COOKIE[$localizationCookie];
}
?>

To set language you need to use
PHP:
setLocalizationLanguage($language)
after clicking some flag for example:
PHP:
setLocalizationLanguage("pl")
Now the harder part is that you need to find every file containing text and include the localization.php and then find every string for example: Znote/ZnoteAAC (https://github.com/Znote/ZnoteAAC/blob/master/serverinfo.php#L219)
and change it to use
PHP:
getLocalizationString($string_name)
that you need to add to the json, that's a lot of work so good luck.
 
Back
Top