Socket
Book a DemoInstallSign in
Socket

@devraelfreeze/i18n

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devraelfreeze/i18n

Simple and lightweight message localisation

latest
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

GitHub issues GitHub stars GitHub license npm
npm (tag)

❓ i18n

Simple and lightweight message localisation.

📥 Installation

To install the package, type the following command in your console:

npm i @devraelfreeze/i18n

🛠️ API

ValuesDescription
new I18n(default_locale, locales)Create a new I18n instance
default_locale The name of the default locale
localesObject of localised messages
ValuesDescription
i18n.getLocale(locale)Get a locale
localeLocale name

Returns a function which calls getMessage using the given locale name (or the default).

ValuesDescription
i18n.getMessage(locale, message, ...args)Get a message from a specifc locale, message, ...args
localeLocale name
messageDot notation string for the message
...argsPlaceholders / Pluralisation

⬇️ Examples

const I18n = require('@devraelfreeze/i18n');
const i18n = new I18n('english', {
	english: {
		welcome: 'Hello, world'
	},
	french: {
        welcome: 'Bonjour tout le monde'
	}
});

/** Note: you should check if the locale exists in i18n.locales */
const french_i18n = i18n.getLocale('french'); // get locale
console.log(french_i18n('welcome')); // -> 'Bonjour tout le monde'

/** This code does exactly the same */
console.log(i18n.getMessage('french', 'welcome'));

🐛 Bugs Report

If you have any bugs, feel free to open an issue on Github Repository

If you want more support, you can contact me on Discord: devRael#0123

🗃️ Old Versions

If you want to use old version, you can use command

npm i @devraelfreeze/discordjs-pagination@<version>

📝 License

Copyright © 2022 devRael1
This project is MIT licensed.

Keywords

i18n

FAQs

Package last updated on 03 Aug 2022

Did you know?

Socket

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.

Install

Related posts