|
1 | | ---- |
2 | | -title: Swift |
3 | | ---- |
4 | | - |
5 | 1 | # Swift |
6 | 2 |
|
7 | 3 | We use both [SwiftLint](https://github.com/realm/SwiftLint) and |
@@ -146,6 +142,33 @@ class ClassName { |
146 | 142 | - We prefer "Tapped" instead of "Pressed", "Touched", or "Clicked" when describing buttons or other |
147 | 143 | screen elements being tapped, in line with Apple calling this a tap gesture. |
148 | 144 |
|
| 145 | +## Localization |
| 146 | + |
| 147 | +- We use Crowdin to crowd-source our localizations, based off of the English text. More information |
| 148 | + on how to contribute translations and how we use Crowdin within Bitwarden can be found |
| 149 | + [here](https://contributing.bitwarden.com/contributing/#localization-l10n). |
| 150 | +- We use `.strings` files for localization. Therefore only the English `Localizable.strings` file |
| 151 | + needs to be updated when adding strings; we have regular jobs in GitHub that take care of syncing |
| 152 | + other translations with Crowdin. |
| 153 | +- Keys in `Localizable.strings` should be a CamelCased string of the English text, rather than a |
| 154 | + description of where the key is used. As a result, if the English text changes, the key should |
| 155 | + likewise change—this allows translators in Crowdin to know that they need to likewise update the |
| 156 | + localized text. |
| 157 | +- Contractions can be converted to un-contracted form in the key, particularly if it aids with |
| 158 | + readability. |
| 159 | +- If the string in question is particularly long, a truncated form with `DescriptionLong` appended |
| 160 | + is reasonable. |
| 161 | +- If possible, keys (and therefore corresponding localized text) should be the same between iOS and |
| 162 | + Android. |
| 163 | + |
| 164 | +Some examples: |
| 165 | + |
| 166 | +```text |
| 167 | +"UseFingerprintToUnlock" = "Use fingerprint to unlock"; |
| 168 | +"EncryptionKeyMigrationRequiredDescriptionLong" = "Encryption key migration required. Please login through the web vault to update your encryption key."; |
| 169 | +"YouAreAllSet" = "You're all set!"; |
| 170 | +``` |
| 171 | + |
149 | 172 | ## File Names |
150 | 173 |
|
151 | 174 | - Swift files are named per Swift convention of CamelCase of the primary class name in the file. |
|
0 commit comments