1.0.2 • Published 1 year ago

simple-localization-app v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Simple Localization Package

This is a lightweight JavaScript package for managing translations in web applications.

Installation

You can install the package using npm:

npm install simple-localization-package

Usage

Importing the Package

const Localization = require('simple-localization-package');
const localization = new Localization();

Adding Translations

// Adding translations
localization.addTranslation('en', { hello: 'Hello', goodbye: 'Goodbye' });
localization.addTranslation('es', { hello: 'Hola', goodbye: 'Adiós' });

Setting Default Language

// Setting default language
localization.setDefaultLanguage('en');

Translating

// Translating
console.log(localization.translate('hello')); // Output: Hello
console.log(localization.translate('goodbye', 'es')); // Output: Adiós
console.log(localization.translate('welcome', 'fr')); // Output: welcome (fallback to key if translation not found)

Contributing

If you would like to contribute to this project, please follow the contribution guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.0.2

1 year ago

1.0.1

1 year ago