You are here: HomeOther ExtensionsSmart CountdownTranslations

Translations

1 User Rating:  / 0
PoorBest 

Smart Countdown module comes out of the box with translations to English (both backend and frontend), Spanish and Russian (frontend only).

The frontend part of translation is about time labels ("Days", "Hours", etc.) only and is performed in the same way as module settings field names translation in backend, i.e. using language .ini files. The event title/texts can not be translated automatically because they are always user-defined strings, so it has nothing to do with translation: you simply enter these texts in each copy of the module (one per language) or (with Localization plugin installed) in corresponding "Localized strings" fieldsets.

If you have to publish Smart Countdown module to a site in a language that is not included in original package or would like to edit existing translation it is necessary to add or edit language .ini files.

Create a new file <language_code>.mod_smartcountdown.ini, where language_code corresponds to the language you are going to translate to (e.g. es-ES.mod_smartcountdown.ini for spanish) and save it into the corresponding language subfolder in your joomla directory "/language/" floder (e.g. /language/es-ES/).

Copy all en-GB.mod_smartcountdown.ini content to this new file.

The following keys have to be redefined (a part of en-GB .ini file is given as a sample - if you are happy with English terms in backend you can leave the rest of the keys unchanged)

; Time units
MOD_SMARTCOUNTDOWN_N_DAYS="Days"
MOD_SMARTCOUNTDOWN_N_HOURS="Hours"
MOD_SMARTCOUNTDOWN_N_MINUTES="Minutes"
MOD_SMARTCOUNTDOWN_N_SECONDS="Seconds"
MOD_SMARTCOUNTDOWN_N_DAYS_1="Day"
MOD_SMARTCOUNTDOWN_N_HOURS_1="Hour"
MOD_SMARTCOUNTDOWN_N_MINUTES_1="Minute"
MOD_SMARTCOUNTDOWN_N_SECONDS_1="Second"
; Default event texts - optional, just in case are experimenting with layout and style
; these strings appear if event text is empty
MOD_SMARTCOUNTDOWN_TEXT_DOWN_DEFAULT="Time left:"
MOD_SMARTCOUNTDOWN_TEXT_UP_DEFAULT="Time passed:"

(Note that both singular and plural forms are provided for each time unit.)

If you wish to add your translation to the module's installation package you will have to add your translation file to the package zip archive (creating a subfolder in language folder) and modify mod_smartcountdown.xml - add a line similar to existing <language /> lines but with your new language code and file name.

For the majority of languages that's all you have to do. French "zeros" seem to be singular (unlike English, German, etc.) but the module is aware of this fact and should work correctly with the same keys as listed above.

But there are languages that require some special processing (Russian, at least) and this module is prepared for such cases. Language model used in Smart Countdown design is easily extensible.

The php part of the script (see tmpl/default.php) uses core JText::plural method to render time labels and should work fine for all supported languages (may be you will have to add keys with more suffices to .ini file like 'MOD_SMARTCOUNTDOWN_N_DAYS_2' for Russian but if you are installing a specific language you certainly know what to do).

On the other hand, the javascript part can operate only with the key-string pairs that have been previously pushed to js script by the main module's script (see mod_smartcountdown.php). While runnung, the js script must decide which key to use calling mod_smartcountdown_plural(n) function (analogue of JText::plural()) with the current value of the counter as an argument. Main module php script is responsable for adding one of js files with this function to the document. These files must reside in '/plural_js' subfolder and be named as follows: 'plural.js' (default and suitable for most languages), or 'plural_<language-tag>.js' if the language needs some special processing. So, the module php script first looks for the language-specific 'plural_<active-language-tag>.js' file and loads it if the file exists. Otherwise plural.js is used.

The files already existing in '/plural_js' subfolder (plural.js, plural_fr-fr.js and plural_ru-ru.js) will serve you as a guide if you have to add your own implementation of plural. Just note that if you are adding support for a language and default plural.js works fine for you there is no need to create another plural.js version for that specific language. Also if your new language uses more keys (with other suffices) do not forget to push them to js (see com_smartcountdown.php check for 'ru-ru' tag as an example).

SmartCalc is published on JED
4 4 4 4
5 5 5 5
7 7 7 7
Days
0 0 0 0
0 0 0 0
Hours
3 3 3 3
6 6 6 6
Minutes
3 3 3 3
8 8 8 8
Seconds