Closed Izrab closed 5 years ago
is it important?
Yes, it is. Imagine nativescript-plugin-firebase
did not demos.
@Izrab I will add it soon
Add a real world example, like an app which supports English and Arabic, user changes language in settings and app instantly becomes RTL. Use this localization style for the demo إن شاء الله
export const localisedStrings = {
test: {
"en": "test",
"ar": "اختبار",
"ku": "تاقیکردنەوە",
},
cancel: {
"en": "Cancel",
"ar": "إلغاء",
"ku": "داخە",
}
}
export function getLocalisedString(
name,
locale,
) {
const baseStrs = localisedStrings[name];
const baseStr = baseStrs[locale];
return baseStr;
}
// Example usage: getLocalisedString("test", appSettings.getString("language"))
@Izrab you can use https://github.com/EddyVerbruggen/nativescript-i18n for multi-languages support
I used it (Angular):
<RtlGridLayout [isRtl]="'rtl' | L" columns="auto *"></RtlGridLayout>
i18n/ar/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">يهمني</string>
<string name="title_activity_kimera">يهمني</string>
<string name="lang">ar</string>
<string name="rtl">true</string>
</resources>
i18n/en/strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">yahmini</string>
<string name="title_activity_kimera">yahmini</string>
<string name="lang">en</string>
<string name="rtl">false</string>
</resources>
Unlike many other plugins, this plugin does not have any demos