
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@gravity-ui/i18n-cli
Advanced tools
Provides i18n configuration for the project
Provides the i18n-cli command for managing language files in the project.
Install the package:
npm i -D @gravity-ui/i18n-cli
Createthe config file i18n.config.ts in the project root:
import {defineConfig} from '@gravity-ui/i18n-cli/config';
export default defineConfig({
allowedLocales: ['ru', 'en', 'ru-kz', 'en-kz'] as const,
fallbackLocales: {
'ru-kz': 'ru',
'en-kz': 'en',
},
defaultFallback: 'en',
clientIntlModule: {
path: 'src/shared/i18n/intl.ts',
alias: '@shared/i18n',
},
});
Import the config in the i18n library instance (i18n-react and i18n-node)
import {createIntl} from '@gravity-ui/i18n-react';
import i18nConfig from '../../../i18n.config';
const {allowedLocales, fallbackLocales, defaultFallback} = i18nConfig;
export const intl = createIntl({
allowedLocales,
fallbackLocales,
defaultFallback,
});
create-keysChecks the provided file/directory for calls to missing keys and adds them to the i18n.ts file.
npx i18n-cli create-keys src/ui/SomeComponent/SomeComponent.tsx
npx i18n-cli create-keys src/ui/ComponentDirectory
find-unusedRecursively search for unused keys starting from the specified directory.
npx i18n-cli find-unused src/ui/SomeComponent
npx i18n-cli find-unused -d src/ui/SomeComponent
Type: string[]
Allowed locales in the project.
{
allowedLocales: ['ru', 'en'] as const,
}
Fallbacks for given locales. More details can be found in i18n-core.
Default fallback. Used if no higher priority fallback is found. More in i18n-core.
Location of the library instance for the client-side i18n-react in the project.
{
clientIntlModule: {
// Path to the module with intl library instance
path: 'src/ui/shared/i18n.ts',
// TypeScript alias of the module with intl library instance
alias: '@shared/i18n';
}
}
Server-side library instance location i18n-node in the project.
{
serverIntlModule: {
// Path to the module containing the intl library instance
path: 'src/server/utils/i18n.ts',
// TypeScript alias of the module containing the intl library instance
alias: undefined,
// Regular expressions that determine if a module belongs to the server-side
pathMatchers: [/src\/server\/.+$/]
}
}
FAQs
- Provides i18n configuration for the project
The npm package @gravity-ui/i18n-cli receives a total of 885 weekly downloads. As such, @gravity-ui/i18n-cli popularity was classified as not popular.
We found that @gravity-ui/i18n-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.