:join
This schematic merges all your translation files into a single file for each language.
Command
If you have more than one entry folder for your translation files, you will need to add a mapping for each folder entry and the corresponding scope name using the scopePathMap
property in your global config file.
By default, the build script will traverse the root translation file directory and treat every subdirectory as a scope.
For example, if your translation folder structure is:
The script will iterate all the files (excluding the default language) and merge the scope files into the main translation files.
Assuming the default language is English, running the script will produce the following outputs:
If you have multiple entry folders for a scope, you can specify the map between the scope name and the translation path using scopePathMap
in your global config file.
Example (transloco.config.ts
)
transloco.config.ts
)Once you specify the scopePathMap
, the script will automatically use it.
Options
Option
Alias
Description
Type
Default
--translation-path
root
The folder that contains the root translation files.
string
src/assets/i18n
--out-dir
o
The output directory path where the merged translation files will be saved.
string
dist-i18n
--default-lang
-
The default language of the project.
string
-
--include-defaultLang
-
Determines whether to join the default language file as well.
boolean
false
Usage Example
Last updated