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
tprop 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 thesrcfolder
Files:
tkeys.json- contains a map of all collected translation keys
Nitrolib also exports its translation keys in the
@kiwicom/nitro/tkeys.jsonfile
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:
pathoptional - path to a custom translations foldergranularoptional - createsbrandLanguagesfolder, which containsbrandName/brand.jsonfolders
Requires:
- The
data/tkeys.jsonfile to exist due to translation whitelisting, see thekeyscommand - The
@kiwicom/translationspackage 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:
granularoptional - creates next folders:brands, airlines, countries, languagesinstead 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