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

Paywall Components Localized Strings #4237

Merged
merged 105 commits into from
Sep 6, 2024

Conversation

jamesrb1
Copy link
Contributor

@jamesrb1 jamesrb1 commented Sep 3, 2024

  • Adds localized string support to paywall components
    -This is primarily done in TemplateComponentsView's static function chooseLocalization.

  • Validates that promised localized strings are actually available.
    -This is done as component view models are created (see TextComponentViewModel), by throwing if an expected key is not present:
    self.text = try localizedStrings.string(key: component.textLid)
    -This pattern should be followed for every property that represents a localized string id, which ensures a non-nil value for every value.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-09-03.at.17.39.47.mov

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just some small nitpicks but will leave to others to approve.

@jamesrb1
Copy link
Contributor Author

jamesrb1 commented Sep 5, 2024

@RCGitBot please test

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things but real close! This localization handling looks 🔥

Copy link
Member

@joshdholtz joshdholtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍

@jamesrb1 jamesrb1 merged commit edeff27 into main Sep 6, 2024
5 checks passed
@jamesrb1 jamesrb1 deleted the paywalls-components/localiztion-take-2-v2-pt2 branch September 6, 2024 16:35
@tonidero
Copy link
Contributor

Changing labels from pr:feat to pr:refactor for now, so it's assigned correctly in the changelog.

@tonidero tonidero added pr:refactor and removed pr:feat A new feature labels Sep 12, 2024
nyeu pushed a commit that referenced this pull request Oct 2, 2024
- Adds localized string support to paywall components
-This is primarily done in `TemplateComponentsView`'s static function
`chooseLocalization`.

- Validates that promised localized strings are actually available.
-This is done as component view models are created (see
`TextComponentViewModel`), by throwing if an expected key is not
present:
`self.text = try localizedStrings.string(key: component.textLid)`
-This pattern should be followed for every property that represents a
localized string id, which ensures a non-nil value for every value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants