Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] {xct:Translate String} works only for currently open pages #745

Closed
maxkoshevoi opened this issue Jan 11, 2021 · 2 comments · Fixed by #749
Closed

[Bug] {xct:Translate String} works only for currently open pages #745

maxkoshevoi opened this issue Jan 11, 2021 · 2 comments · Fixed by #749
Labels
a/i18n 🌐 bug Something isn't working. Breaky break.

Comments

@maxkoshevoi
Copy link
Contributor

Description

If user changes language with LocalizationResourceManager.Current.SetCulture(), all strings localized with {xct:Translate String} on currency open pages get updated to new language, but if user opens new page it will be localized with old language.

Steps to Reproduce

  1. Open some page (page has language A)
  2. Change culture to language B with LocalizationResourceManager.Current.SetCulture()
  3. Open new page with some string localized with {xct:Translate String}
  4. New page will be localized with language A instead of B

Expected Behavior

Newly opened pages respect current language

Actual Behavior

Newly opened pages localized using language app was opened with

Basic Information

  • Version with issue: 1.0.0
  • Last known good version:
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android: 10
    • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Workaround

Manually localize all strings from the code

Reproduction imagery

Reproduction Link

@maxkoshevoi maxkoshevoi added bug Something isn't working. Breaky break. s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged. labels Jan 11, 2021
@sthewissen
Copy link
Contributor

I have seen this behavior in my own app too and have been working on a fix there. I will have to look at how I can implement this the easiest within the current XCT API without breaking it.

@sthewissen sthewissen added a/i18n 🌐 and removed s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged. labels Jan 12, 2021
@maxkoshevoi
Copy link
Contributor Author

maxkoshevoi commented Jan 12, 2021

I have seen this behavior in my own app too and have been working on a fix there. I will have to look at how I can implement this the easiest within the current XCT API without breaking it.

I think, I found the cause for this issue. Thread.CurrentThread.CurrenUICulture is not persisted between pages. To fix it just for your app, you can store culture yourself and set Thread.CurrentThread.CurrenUICulture manually in constructor for each page.

I think it should work.

I created PR to fix issue in XCT itself.

maxkoshevoi added a commit to maxkoshevoi/NureTimetable that referenced this issue Jan 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/i18n 🌐 bug Something isn't working. Breaky break.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants