-
Notifications
You must be signed in to change notification settings - Fork 3.1k
How to add and modify Strings
This file contains all strings for Firefox iOS. // As we continue to update strings, old strings may be present at the bottom of this file. To preserve a clean implementation of strings, this file should be organized alphabetically, according to specific screens or feature, on that screen. Each string should be under a struct giving a clear indication as to where it is being used. In this case we will prefer verbosity for the sake of accuracy, over brevity. Sub structs may, and should, also be used to separate functionality where it makes sense, but efforts should be made to keep structs two levels deep unless there are good reasons for doing otherwise.
Note that some strings belong to one feature that appears across multiple screens throughout the application. An example is contextual hints. In this case, it makes more sense to organize all those strings under the specific feature.
- Create or find the proper
structto add those strings in. If there's nostructthat fits in, create one related to the feature or section this string will be under following the guidelines explained above. - Create the new
MZLocalizedStringunder thisstructmaking sure it follows the documentation. Particularly make sure that:- The
keyhas a clear explicit name following the structure of where it is located, ended with the version the string was included in. This is to ensure that we can easily modify that string if needed later on, as well as monitoring string import PRs easily. - The
tableNameis defined and not nil. - The
valueis defined and not nil. - The
commentfollows the l10n guidelines.
- The
- Once all new strings are added, open a PR on Firefox for iOS.
- Once merged, the new strings will be exported automatically to the Firefox l10n repository through the next automated Github action.
Any new string should have the same structure as the following example:
public static let TurnOnNotificationsTitle = MZLocalizedString(
key: "Settings.Notifications.TurnOnNotificationsTitle.v112",
tableName: "Settings",
value: "Turn on Notifications",
comment: "This is the title informing the user needs to turn on notifications in iOS Settings."
)
The following applies only to strings you modify that were already exported to the l10n repository. If they weren't exported you can modify the
valueonly (please check with the l10n team to confirm it wasn't exported).
Modifying a string means we need to modify at least two part of the MZLocalizedString, the key and the value. Sometimes the comment will also need to be adjusted, so please make ensure the comment still make sense following the string update. When modifying a string, we will create a new version of that string in the same struct, making sure to keep the old version of that string alive until the version it was last used in is released on the App Store.
- Create a new
MZLocalizedStringbelow the old version of this string, modifying itskeyandvalue. You cannot modify thevalueonly, since we need a newkeyfor the string to be exported.
Here's an example
public static let TurnOnNotificationsTitle = MZLocalizedString(
key: "Settings.Notifications.TurnOnNotificationsTitle.v112",
tableName: "Settings",
value: "Turn on Notifications",
comment: "This is the title informing the user needs to turn on notifications in iOS Settings.",
lastUsedInVersion: 118
)
public static let TurnOnNotificationsTitle = MZLocalizedString(
key: "Settings.Notifications.TurnOnNotificationsTitle.v118",
tableName: "Settings",
value: "Turn on Notifications Feature",
comment: "This is the title informing the user needs to turn on notifications feature in iOS Settings."
)