-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Issue
Current localization naming is hard to debug since there's no standard
yet. Below is the new standard for localization variable naming.
Rules
-
Name should be descriptive and direct. Don't use the actual translated text
as the name, e.g instead ofinvalidCredentials, usesignInErrorMessage. -
camelCasestill be used, but with$as paths separator, so the format
will be<scope>$<subScope>$<name>.Scopes:
-
libsSub scopes will be folder names under
libs. -
modulesSub scopes will be folder names under
modules/routessince it's the
one that need localization.
-
-
The orders still use alphabetical order.
Examples
{
"libs$widgets$customCameraDialog$appBarTitle": "Custom Camera",
"modules$auth$signInRoute$signInErrorMessage": "Invalid credentials"
}
-
libs$widgets$customCameraDialog$appBarTitle, it means this is localization
forCustomCameraDialogwidget's app bar title. -
modules$auth$signInRoute$signInErrorMessage, it means this is localization
forSignInRoute's error message on sign in.
Advantages
- Easy to track where the localization is used, which mean it's easier to
debug.
Disadvantages
- The localization name will be long since it's a nested structure.
- Its quite hard to read since dollar sign is used as separator, so why not
use-or_? because it will cause lint error.
Additional Images/Videos
No response