Decybel07 / L10n-swift

Localization of the application with ability to change language "on the fly" and support for plural form in any language.
MIT License
315 stars 32 forks source link

Language change on macOS doesn't update system menubar items #34

Closed voltangle closed 1 year ago

voltangle commented 1 year ago

Short description of the issue.

System (default) menubar items don't update after a language change

What did you expect to happen?

Menubar adapts to new language selected

What happened instead?

Menubar didn't adapt to new language

How to reproduces this problem?

  1. Start app
  2. Take note of the menubar
  3. Change language
  4. See no changes

Environment

UI framework: SwiftUI System: macOS Ventura 13.0

DebugDescription

L10n {
    Language: uk
    Preferred language: en
    Supported languages: ["en", "uk", "ru"]
    Bundles: [
        "/Users/egoryakovenko/Library/Developer/Xcode/DerivedData/Moc-cmqpfvhdudhbgibqasempmgnurue/Build/Products/Debug/Moc.app/Contents/Resources/uk.lproj",
        "/Users/egoryakovenko/Library/Developer/Xcode/DerivedData/Moc-cmqpfvhdudhbgibqasempmgnurue/Build/Products/Debug/Moc.app/Contents/Resources/en.lproj"
    ]
}

(bundles change time to time, sometimes i have uk, sometimes i don't)

L10n-swift version: 5.10.2

Xcode version: Xcode 14.1 Build version 14B47 xcodebuild -version

Swift version: _swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.2 clang-1400.0.29.51) Target: x8664-apple-macosx13.0 swift -version

Platform(s):

File format(s):

Installation method:

Decybel07 commented 1 year ago

L10n.shared.language = "uk" this property don't reload views! It only sets language for future localization.

For reload all text you have to force reload main scene/window in your application.