CLI
Run yarn nitro <command>
. Available commands:
All files are saved into the <PROJECT_ROOT>/data
folder.
Keys
yarn nitro keys [...globs]
Collects translation keys:
- wrapped in the
__
function - used as the
t
prop in JSX
Args:
globs
- a list of globs where to search for translation keys as an argument
Example:
yarn nitro keys
- only collects Nitrolib’s keysyarn nitro keys 'src/**/*.{js,jsx}'
- collects Nitrolib’s keys as well as all keys in thesrc
folder
Files:
tkeys.json
- contains a map of all collected translation keys
Nitrolib also exports its translation keys in the
@kiwicom/nitro/tkeys.json
file
Keys check
yarn nitro keys-check
Checks if all keys are translated. Run keys
and translations
to get translations.
Translations
yarn nitro translations [--translations <path>]
Fetches translations.
Flags:
path
optional - path to a custom translations foldergranular
optional - createsbrandLanguages
folder, which containsbrandName/brand.json
folders
Requires:
- The
data/tkeys.json
file to exist due to translation whitelisting, see thekeys
command - The
@kiwicom/translations
package installed if not using a custom project
Example:
yarn nitro translations
- fetches datayarn nitro translations --path ./locales
- fetches data and translations from a custom folder
Files:
translations/<locale>_<hash>.json
- translations for the given locale, cache-busted with the commit hashbrandLanguages.json
- contains information about languages for different brands, see BrandLanguagetranslationsFiles.json
- contains a map of a locale to its translation file
Fetch
yarn nitro fetch
Fetches production data.
Example:
yarn nitro fetch
- fetches data
Flags:
granular
optional - creates next folders:brands, airlines, countries, languages
instead of single json.files
Files:
airlines.json
- contains basic information about supported airlines, see Airline.jsbrands.json
- contains brand config, see Brandcontinents.json
- contains a list of continents and their countries, see Continentscountries.json
- contains basic information about all the world’s countries, see Countrylanguages.json
- contains information about our supported languages, see LangInfo