more documentation for I18n JS utility
This commit is contained in:
parent
3b14a4f03d
commit
2d67bec956
@ -1,8 +1,18 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Global I18n registry that stores and serves translations.
|
||||
// Each translation must have a unique ID.
|
||||
/**
|
||||
* I18n
|
||||
*
|
||||
* This module stores and serves translated strings, according to the users language settings.
|
||||
*
|
||||
* Translations are stored in /messages/frontend/*.msg.
|
||||
*
|
||||
* To make additions to any of these files accessible to JavaScrip Utilities
|
||||
* you need to add them to the respective *.msg file and to the list of FrontendMessages
|
||||
* in /src/Utils/Frontend/I18n.hs.
|
||||
*
|
||||
*/
|
||||
window.I18n = (function() {
|
||||
|
||||
var translations = {};
|
||||
@ -19,7 +29,7 @@
|
||||
|
||||
function getTranslation(id) {
|
||||
if (!translations[id]) {
|
||||
return '(translation missing for »' + id + '«)';
|
||||
throw new Error('I18N Error: Translation missing for »' + id + '«!');
|
||||
}
|
||||
return translations[id];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user