Function simple_localization::tr
source · pub fn tr(text: &str) -> &strExpand description
Get translation of the text in system’s language(env::var("LANG"))
If translation exists returns the translation
else returns the text back.
ⓘ
use simple_localization::tr;
// localization/tr_TR file exists and `LANG=tr_TR.UTF-8`
let text:&str = tr("Hello"); // "Merhaba"
// localization/tr_TR file doesn't exists and `LANG=tr_TR.UTF-8`
let text:&str = tr("Hello"); // "Hello"
// localization/tr_TR file exists and `LANG=ar_QA.UTF-8`
let text:&str = tr("Hello"); // "Hello"