osDate Languages
Adding new languages to osDate is very simple. There are just two steps:
1) Create a new directory structure in the "languages" folder for your new language. For example, to add the German language, you would create a directory structure like this:
/language
/lang_german
/lang_main.php
There are two important settings which are likely to be unique for each language:
$lang['ENCODING'] = 'iso-8859-1'; $lang['DIRECTION'] = 'ltr';
The text direction is likely to remain "ltr" for most languages, except possibly Arabic and Hebrew, which display text from right to left, "rtl", instead of left to right. Now, it's just a matter of translating... you should only translate the right side of each line, as such:
$lang['main_menu'] = 'Hauptmenu';
The left side text is used by osDate to identify the phrase, and the right side is the actual translated value.
2) In config.php, add your new language to both of the following arrays:
$language_options = array( 'english' => 'English', 'german' => 'German' ); $language_files = array( 'english' => 'lang_english/lang_main.php', 'german' => 'lang_german/lang_main.php' );
Now, open the Global Site Settings admin tool and load the new language file. You'll observe that any non-translated lines will be substituted with the corresponding phrases from the English language file.
Also, please ensure that you observe the following rules while editing the new language file:
- If you need quotes within the phrase, escape them with backslashes; i.e.,
$lang['dont_stay_alone'] = 'Don\'t stay alone,';
- Constants like SITENAME are in all-caps and should not be translated.
If you have developed a new language translation, and would like to share it with the entire osDate community, you can do so by uploading to the Code Depot.
Thanks and good luck!
Darren