Skip to content

refactor: Localizations Naming #47

@KeidsID

Description

@KeidsID

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 of invalidCredentials, use signInErrorMessage.

  • camelCase still be used, but with $ as paths separator, so the format
    will be <scope>$<subScope>$<name>.

    Scopes:

    • libs

      Sub scopes will be folder names under libs.

    • modules

      Sub scopes will be folder names under modules/routes since 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
    for CustomCameraDialog widget's app bar title.

  • modules$auth$signInRoute$signInErrorMessage, it means this is localization
    for SignInRoute'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

Metadata

Metadata

Assignees

Labels

patchBug fixes, or other updates to existing featuresseverity-2Minor severity, but should be resolved soon.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions