single: will do a single query when getting the translated text
all: will get all translations then return the translated text (will be cached shortage)
should-cache
boolean
If turned on, it will use the all strategy to get all the translations, then put all the translations into the default cache driver.
Usage
Facade Style
useSaasReady\Facade\SaasTranslator;// welcome-text = "Hello :user"// this will give you: Hello Seth Phat$welcomeText =SaasTranslator::translate('welcome-text', ['user'=>'Seth Phat',]);
DI style
Functional style
Render Translations
If you wish to render the translation file (en.json, vi.json,...) and utilize the __() method of Laravel (for your Blade views or anything), then we have this command:
It will render the json file and store it into your lang (new) or resources/lang (old)