Skip to content

Commit 7ce74ca

Browse files
Add Localization section to Swift Style Guide (#590)
* Add crowdin section * Un-wishy-wash * Add link to company Crowdin documentation
1 parent 2100b6c commit 7ce74ca

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

docs/contributing/code-style/swift.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
title: Swift
3-
---
4-
51
# Swift
62

73
We use both [SwiftLint](https://github.com/realm/SwiftLint) and
@@ -146,6 +142,33 @@ class ClassName {
146142
- We prefer "Tapped" instead of "Pressed", "Touched", or "Clicked" when describing buttons or other
147143
screen elements being tapped, in line with Apple calling this a tap gesture.
148144

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+
149172
## File Names
150173

151174
- Swift files are named per Swift convention of CamelCase of the primary class name in the file.

0 commit comments

Comments
 (0)