Skip to content
This repository was archived by the owner on Mar 15, 2023. It is now read-only.

Commit e3f534b

Browse files
author
Jacob van Mourik
committed
Added howto for loading additional namespaces.
1 parent 5dd8bd6 commit e3f534b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ Notice that the above path to the locales does not have a trailing slash.
2323
The plugin will do a trailing slash check when defining the path, so you
2424
may include it or not.
2525

26+
### Loading additional namespaces
27+
28+
With i18next you can load multiple namespaces and refer to them when
29+
calling translate with a key (for example i18next.t("namespace:key").
30+
31+
This plugin gives you the option to load additional namespaces
32+
immediately when loading a locale by doing:
33+
34+
```javascript
35+
require(["some/module", "i18n!path/to/locales:namespace1,namespace2"],
36+
function(module, i18n) {
37+
// The additional namespaces "namespace1" and "namespace2" are
38+
// now loaded and ready for use
39+
}
40+
);
41+
```
42+
NOTE: when using the supportedLngs option mentioned below, be sure to
43+
add this additional namespaces to the list of supported namespaces.
44+
2645
## Configuration
2746

2847
### Plugin setup
@@ -120,4 +139,4 @@ used as supported languages.
120139

121140
## License
122141

123-
This project is released under the MIT license.
142+
This project is released under the MIT license.

0 commit comments

Comments
 (0)