-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces | ||
internal enum Localization { | ||
internal enum Alert { | ||
internal enum Action { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we could potentially make the indentation bigger to conform to swift standards? As this file can be generated from the command line, it's not a big issue but it would just look better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could take a look, probably there's a parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I investigated, apparently there's no way of doing this. In theory, I could modify the stencil so that it has four spaces. This would deviate us greatly from the official one. Wouldn't be the worst but we would have to decide if it's worth it. A benefit of being close to the original is that if they update it, we can just add our few changes easily. What do you think would be best?
4aa88d5
to
e980848
Compare
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
!merge |
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 calledLocalization.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 theLocalizable.strings
as always, and theDeprecated.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 withandroid
. This is because on the new way to do strings, the Android-specific ones will start withandroid.
. 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 isinternal
, as opposed toL10n.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 withL10n.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