Giter Site home page Giter Site logo

i18n's Introduction

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

Values Description
new I18n(default_locale, locales) Create a new I18n instance
default_locale The name of the default locale
locales Object of localised messages
Values Description
i18n.getLocale(locale) Get a locale
locale Locale name

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

Values Description
i18n.getMessage(locale, message, ...args) Get a message from a specifc locale, message, ...args
locale Locale name
message Dot notation string for the message
...args Placeholders / 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.

i18n's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.