|
6 | 6 | This is a plugin for NativeScript that implements internationalization (i18n) using the native platforms standards. |
7 | 7 | It is inspired from [nativescript-i18n](https://github.com/rborn/nativescript-i18n) |
8 | 8 |
|
| 9 | +## Table of contents |
| 10 | +* [Installation](#installation) |
| 11 | +* [Usage](#usage) |
| 12 | + * [Angular](#angular) |
| 13 | + * [Javascript](#javascript) |
| 14 | +* [File format](#file-format) |
| 15 | +* [Frequently asked questions](#frequently-asked-questions) |
| 16 | + * [How to set the default language?](#how-to-set-the-default-language) |
| 17 | + * [How to localize the application name?](#how-to-localize-the-application-name) |
| 18 | + * [How to localize iOS properties?](#how-to-localize-ios-properties) |
| 19 | + |
9 | 20 | ## Installation |
10 | 21 | ```shell |
11 | 22 | tns plugin add nativescript-localize |
@@ -76,28 +87,6 @@ const localize = require("nativescript-localize"); |
76 | 87 | console.log(localize("Hello world !")); |
77 | 88 | ``` |
78 | 89 |
|
79 | | -## Default language |
80 | | -Add the `.default` extension to the default language file to set it as the fallback language: |
81 | | -``` |
82 | | -fr.default.json |
83 | | -``` |
84 | | - |
85 | | -## Localize the application name |
86 | | -The `app.name` key is used to localize the application name: |
87 | | -```json |
88 | | -{ |
89 | | - "app.name": "My app" |
90 | | -} |
91 | | -``` |
92 | | - |
93 | | -## Localize iOS properties |
94 | | -Keys starting with `ios.info.plist.` are used to localize iOS properties: |
95 | | -```json |
96 | | -{ |
97 | | - "ios.info.plist.NSLocationWhenInUseUsageDescription": "This will be added to InfoPlist.strings" |
98 | | -} |
99 | | -``` |
100 | | - |
101 | 90 | ## File format |
102 | 91 | Each file is imported using `require`, use the file format of your choice: |
103 | 92 |
|
@@ -128,3 +117,26 @@ const i18n = { |
128 | 117 |
|
129 | 118 | module.exports = i18n; |
130 | 119 | ``` |
| 120 | + |
| 121 | +## Frequently asked questions |
| 122 | +### How to set the default language? |
| 123 | +Add the `.default` extension to the default language file to set it as the fallback language: |
| 124 | +``` |
| 125 | +fr.default.json |
| 126 | +``` |
| 127 | + |
| 128 | +### How to localize the application name? |
| 129 | +The `app.name` key is used to localize the application name: |
| 130 | +```json |
| 131 | +{ |
| 132 | + "app.name": "My app" |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +### How to localize iOS properties? |
| 137 | +Keys starting with `ios.info.plist.` are used to localize iOS properties: |
| 138 | +```json |
| 139 | +{ |
| 140 | + "ios.info.plist.NSLocationWhenInUseUsageDescription": "This will be added to InfoPlist.strings" |
| 141 | +} |
| 142 | +``` |
0 commit comments