From 2d67bec95657489fa3e3169a80540a17f1d83301 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Fri, 12 Apr 2019 22:01:28 +0200 Subject: [PATCH] more documentation for I18n JS utility --- static/js/services/i18n.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/static/js/services/i18n.js b/static/js/services/i18n.js index 1e314cab4..730e11935 100644 --- a/static/js/services/i18n.js +++ b/static/js/services/i18n.js @@ -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]; }