Gabryell Corrêa | Author
theSpiderDev | GitHub
[email protected] | Contact Email
This is a JavaScript (ES6) folder that contains generic translations for your system.
Importing
import Translator from "your_project_root_folder/shared-lang";
Using default library
const sharedLang = new Translator(); // Default en-US object
Choosing language library
const sharedLang = new Translator('pt-BR'); // Default pt-BR object
Using custom libraries
import en from 'your_own_en_file'; // { ... }
import es from 'your_own_es_file'; // { ... }
import nl from 'your_own_nl_file'; // { ... }
import pt from 'your_own_pt_file'; // { ... }
const sharedLang = new Translator('pt-BR', { en, es, nl, pt }); // your pt-BR object
Used to make some nice phrases
const {
hi,
hello,
good_morning,
good_afternoon,
good_evening,
good_night
} = sharedLang.greetings;
Used in input labels
const {
email,
password,
send,
sign_up,
to_filter
} = sharedLang.labels;
Used in input's placeholders
const {
email,
password
} = sharedLang.placeholders;
Used in input's validations or messages to the client
const {
empty_email,
empty_password,
wrong_email,
wrong_password,
wrong_credentials
} = sharedLang.validations;
- en-US (Default)
- pt-BR
- nl
- es
Made with love by @theSpiderDev <3