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

Fix: Update tab bar titles on language change #522

Merged
merged 5 commits into from
Dec 15, 2024

Conversation

victorsaccucci
Copy link
Contributor

@victorsaccucci victorsaccucci commented Dec 12, 2024


Description

Added logic to dynamically update the "Installation" tab bar item title when the language changes. The solution involved adding the following line to the InstallationViewController:

title = NSLocalizedString("app.installation.title", value: "Installation", comment: "")

arabic

Observation

I forgot to remove the following code from SettingsViewController, which can be safely removed without any issues:

@objc func setText() {
    tabBarController?.tabBar.items?[0].title = NSLocalizedString("Installation", comment: "").uppercased()
}

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    NotificationCenter.default.removeObserver(self)
}

These were added while I was working on solving the tab bar title issue, and they are no longer needed.

Copy link

github-actions bot commented Dec 12, 2024

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and iOS rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist

  • The linting and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The CI unit test workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis andrewtavis self-requested a review December 13, 2024 08:15
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
removeObserver(object: NotificationCenter.default)
NotificationCenter.default.removeObserver(self)
Copy link
Member

Choose a reason for hiding this comment

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

Would you be able to take a look at this warning here, @victorsaccucci? :)

Copy link
Member

Choose a reason for hiding this comment

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

Note that the removeObserver(...) was removed in 023d8e2.

@andrewtavis
Copy link
Member

Functionality wise this is definitely going in the right direction, @victorsaccucci 😊 Do you have an idea for why we have to switch to the tab in order to get the tab bar label to be localized though? Ideally we'd change the language and everything would be in the given language.

@victorsaccucci victorsaccucci force-pushed the fix-tab-bar-section-rtl branch from 023d8e2 to 7a073e1 Compare December 13, 2024 14:26
@victorsaccucci
Copy link
Contributor Author

I created this viewWillDisappear method inside the SettingsViewController class, and if you check the original source code before my push, it’s not there. So, since it doesn’t make any difference to the app’s functionality, it can be removed.

Now I pulled from the original repository into my branch and only added the following code:

title = NSLocalizedString("app.about.title", value: "Installation", comment: "")

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

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

What a saga :) Thanks much for the initial work here, @victorsaccucci! The solution here was as follows:

  • I removed all the cases where we were setting the title on tab switch, which your contribution turned me on to
  • I set them all on view load for the installation tab
  • The above ultimately works as we have the app set up to always load the installation tab first, as this is needed to assure that when new keyboards are installed, that the user cannot just navigate back to the settings tab which then would not load and update the available keyboards to changes settings for

Really great to have your support on the project!

@andrewtavis andrewtavis merged commit 4af84db into scribe-org:main Dec 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants