3.0.1 • Published 2 years ago

@captaincool/locale-key-generator v3.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Locale Key Generator

Installation

Install the package via npm

npm install -g @captaincool/locale-key-generator

Configuration

By default, keys will be exported based on the contents of config.json. To use a custom configuration, supply its path using the --config argument during execution

locale-keys export -i ./content -o ./output --config=customConfig.json

Usage

# generate locale files for all contexts inside the 'content' directory and output them to 'output'
locale-keys export -i ./content -o ./output

# generate locale files for a specific context
locale-keys export -i ./content -o ./output --contexts=shared,web:feature

# lint the contents of the 'content' directory
locale-keys lint -i ./content

Options

OptionDefaultDescription
baseLanguageen_USFiles with this code in the suffix of the filename will be treated as the base language. Any files which don't contain a base file will be discarded.
outputFormatjsonThe desired export format. Possible values are json or xliff
contextDelimiterKeys:How to specify contexts messages belong to
contextDelimiterFiles__How to specify contexts in the final output files
localeRegionExp/[a-z]{2}_[A-Z]{2}/The pattern to determine locale
keyMatchExp/[\\w]+/The style pattern contexts and message keys should enforce
ignoreFiles'.DS_STORE'A list of files to be ignored by the parser
filenameSuffixA fixed string to apply at the end of the exported file
reservedContextmessagesFiles with this name will be rolled into the same context as their parent. For example, messages contained inside "some/feature/messages.en_US.json" will be namespaced as "some:feature"
indent2Enforce an indentation style either via number of spaces or "tab". Accepts a number or the value "tab"
3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago