Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate old strings resources #718

Merged
merged 1 commit into from
Aug 14, 2023
Merged

Deprecate old strings resources #718

merged 1 commit into from
Aug 14, 2023

Commits on Aug 14, 2023

  1. Deprecate old strings resources

    Instead of trying to reuse some old strings, deprecate some other strings, and
    have them coexist in the same file, I have decided to deprecate the `L10n.swift`
    class altogether, and create a new one called `Localization.swift`. This allows
    me to remove that horrible abbreviated name, and also make a clear distinction
    between old and new. With this, all new strings will just go to the
    `Localizable.strings` as always, and the `Deprecated.strings` ones shouldn't be
    used anymore.
    
    This was done by adding two `.stencil` files: one that handles adding the
    `@deprecated` line to the old file, and a new one that handles ignoring all
    strings that start with `android`. This is because on the new way to do strings,
    the Android-specific ones will start with `android.`. We could remove these from
    the file, but this would be manual, some could be missed, and at the moment of
    this PR, we haven't yet determined how we are going to sync these strings with
    the strings in the Glia Hub.
    
    Finally, the new `Localization.swift` file is `internal`, as opposed to
    `L10n.swift` which is public. This is because these strings have changed from
    being the main way to show strings in the widgets, to being a fallback. Now, the
    Glia Hub will be the main way to pass strings to the widgets, so there's no need
    to shoot ourselves in the foot, making this public, and then have to worry about
    deprecations, as we have to do with `L10n.swift`.
    
    With this, there's no need to have `L10n+BackwardsCompatibility.swift`, as the
    new strings and the old ones are separated entities. However, I still need to
    do a layer that goes between the strings and the rest of the code, for when the
    strings have functionality that is not present anymore (example, placeholders
    for values that now just have the direct value in the string).
    
    In a year, we can easily remove `L10n.swift` and the associated `.stencil` file.
    
    MOB-2529
    gersonnoboa committed Aug 14, 2023
    Configuration menu
    Copy the full SHA
    30898b4 View commit details
    Browse the repository at this point in the history