@vulkano/core 1.24.1 → 1.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/views/helpers/t.js +12 -0
- package/views/helpers/i18n.js +0 -8
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exposes i18next translation as a view helper.
|
|
3
|
+
* Not the raw `i18n` global: Handlebars helpers must be callable functions,
|
|
4
|
+
* not objects with methods — {{ i18n.t('key') }} works in Nunjucks but
|
|
5
|
+
* throws in Handlebars ("fn is not a function") since its helper wrapper
|
|
6
|
+
* invokes whatever is registered directly.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* Nunjucks: {{ t('key') }}
|
|
10
|
+
* Handlebars: {{t "key"}}
|
|
11
|
+
*/
|
|
12
|
+
module.exports = (key, options) => i18n.t(key, options);
|
package/views/helpers/i18n.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bridges the global `i18n` instance (set by bootstrap/services.js) into the
|
|
3
|
-
* Nunjucks environment. Without this, `i18n` exists only in JS scope — views
|
|
4
|
-
* never receive it, since nunjucks.js only auto-adds `app` as a global.
|
|
5
|
-
*
|
|
6
|
-
* Usage in templates: {{ i18n.t('key') }}
|
|
7
|
-
*/
|
|
8
|
-
module.exports = i18n;
|