Scribe
Scribe is a seriously lightweight translator for JavaScript with no dependencies that can be integrated into any project.
Usage
Scribe will not fetch translations, you should get the translations and pass them in the constructor. By default placeholders are define by prepending :
.
; const translations = buttons: save: 'Save' udate: 'Update' delete: 'Delete' validation: range: 'Your range must be within :start and :end' contains: 'The string must contain these phrases: :contain, :contain, :contain' users: email: 'Your email does not match.' const scribe = translations ':'; scribe; // Savescribe; // Your range must be within Monday and Fridayscribe; // The string must contain these phrases: ayy lmao, such wow, dogescribe; // Your email does not match.
If you need to check if a translations exist you can simply use the has
method.
let buttonLabel; if scribe buttonLabel = scribe; else buttonLabel = scribe;
Contributions
All contributions are welcomed. Please only edit src/scribe.ts
and add tests if necessary.