Initial Commit
This commit is contained in:
commit
184685fdd8
6 changed files with 135 additions and 0 deletions
25
README.md
Normal file
25
README.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
How To Use
|
||||
|
||||
Put your translation JSON files inside locales directories anywhere under your project or working directory.
|
||||
|
||||
Each JSON file must be named as the language code, e.g., en.json, es.json.
|
||||
|
||||
Make sure you have a .env file with a locale variable defining your default language code (eg locale=en).
|
||||
|
||||
Start the loader
|
||||
|
||||
Just import or run this script — it immediately:
|
||||
|
||||
Loads all translation files it finds.
|
||||
|
||||
Starts a background thread watching those files for any edits.
|
||||
|
||||
Set language
|
||||
|
||||
Call set_language("fr") to switch the active locale dynamically.
|
||||
|
||||
Fetch translations
|
||||
|
||||
Use _('some.key') anywhere to get the localized string.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue