SwiftUI NavigationTitle does not support Localization in iOS 18

NavigationTitle does not change when the app language changes. It works well in iOS 17.5 but does not in iOS 18.x

Answered by DTS Engineer in 825746022

Thanks for providing the project. I now see the issue.

Given that the issue happens only on iOS 18.x and not on iOS 17.5, I’d firstly suggest that you file a feedback report to see what the SwiftUI folks have to say – If you do so, please share your report ID here.

I didn't reproduce the issue with my own project because I changed the language by changing the system (Settings > General > Language & Region) or per-app (Settings > Apps > My app > Language) language setting, which is different from changing the SwiftUI locale environment from within the app, as demonstrated in your project.

Changing the system or per-app language setting is the standard way of changing an app's language, and it works for your app as well – If you change the setting, you will see that the language of your app's navigation title follows.

If your intent is to provide an in-app language switcher that allows users to change the language without leaving your app, you might want to evaluate it carefully, because changing SwiftUI locale environment only impacts the SwiftUI view hierarchy, and not the system-provided components.

As an example, if your app needs to bring up a file importer using .fileImporter, the importer UI won't honor the locale environment. That will lead to UI language inconsistency, and is is definitely not a good experience.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

The issue you described doesn't happen on my testing app, which uses the standard SwiftUI localization mechanism.

The screenshots you provided seem to indicate that you have an in-app option that allows users to change the app language. If that is the case, please share how you implemented it and I may have more to say. Or if you can provide a minimal project, with detailed steps that reproduce the issue, I may be able to take a look and comment.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Hi Ziqiao,

Here is the github link of the project which is very small https://github.com/bulutoztemur/MemoryBlocksGame . I implemented localization in standard way by using Localizable.xcstrings file. When I switch language first time, all words change. But when I keep changing language all words except navigation titles change.

I got a 404 error when clicking the link you provided...

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Sorry, repo was private. Could you try it again now? @DTS Engineer

I have also created another repo for investigation. It is a bit more lightweight. https://github.com/bulutoztemur/NavigationTitleInvestigation . Feel free to choose one of them to check

Issue still exist

Thanks for providing the project. I now see the issue.

Given that the issue happens only on iOS 18.x and not on iOS 17.5, I’d firstly suggest that you file a feedback report to see what the SwiftUI folks have to say – If you do so, please share your report ID here.

I didn't reproduce the issue with my own project because I changed the language by changing the system (Settings > General > Language & Region) or per-app (Settings > Apps > My app > Language) language setting, which is different from changing the SwiftUI locale environment from within the app, as demonstrated in your project.

Changing the system or per-app language setting is the standard way of changing an app's language, and it works for your app as well – If you change the setting, you will see that the language of your app's navigation title follows.

If your intent is to provide an in-app language switcher that allows users to change the language without leaving your app, you might want to evaluate it carefully, because changing SwiftUI locale environment only impacts the SwiftUI view hierarchy, and not the system-provided components.

As an example, if your app needs to bring up a file importer using .fileImporter, the importer UI won't honor the locale environment. That will lead to UI language inconsistency, and is is definitely not a good experience.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

SwiftUI NavigationTitle does not support Localization in iOS 18
 
 
Q