Javascript Framework I18n
(PHP) i18n with cxjs
In lib/FRAMEWORK/cxjs/i18n
, you will find so-called i18nProviders. ContrexxJavascriptI18nProvider
is an interface implemented by classes in order to provide i18n/l10n data to javascript.
Learning by watching: an example
Given we want to internationalize our HelloWorld function in javascript:
Easily done. Create your I18nProvider, let's say in lib/FRAMEWORK/cxjs/i18n/helloWorld.class.php:
Needless to say this is more or less dummy logic. Your internationalization can be as sophisticated as you like it to be. And what does our function look like now?
You can see two things:
* the variable message was automatically initialized in scope helloWorld (which is the first part of our filename helloWorld.class.php)
* our function needs to be defined inside cx.ready(function() {...}), to make sure the framework finished loading.