https://github.com/thecodingmachine/html.utils.i18nweblibrary
This implementation of a Weblibrary will load different JS files based on the current language used. Useful to load translation files in JS.
https://github.com/thecodingmachine/html.utils.i18nweblibrary
Last synced: 3 months ago
JSON representation
This implementation of a Weblibrary will load different JS files based on the current language used. Useful to load translation files in JS.
- Host: GitHub
- URL: https://github.com/thecodingmachine/html.utils.i18nweblibrary
- Owner: thecodingmachine
- Created: 2012-11-28T13:35:08.000Z (over 13 years ago)
- Default Branch: 3.0
- Last Pushed: 2018-05-23T09:26:33.000Z (about 8 years ago)
- Last Synced: 2025-02-16T12:30:27.471Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
I18nWebLibrary
==============
This special kind of [WebLibrary](http://mouf-php.com/packages/mouf/html.utils.weblibrarymanager/README.md)
will load different Javascript files based on the current locale.
How does it work?
-----------------
You simply put a [lang] placeholder in the file name you want to load.
For instance:
`javascript/messages-[lang].js`
If the current locale used is French, the file requested will be `javascript/messages-fr.js`.
If the current locale used is German, the file requested will be `javascript/messages-de.js`...
If the current locale used is the default one, the file requested will be `javascript/messages-default.js`.
The locale is decided thanks to the `$languageDetection` property of `I18nWebLibrary`.
This property must point to a class implementing [Fine's LanguageDetectionInterface interface](http://mouf-php.com/packages/mouf/utils.i18n.fine/doc/tutorial.md).