Closed entropious closed 6 years ago
Could you answer the following questions?
xyz.lproj
folder (e.g. en.lproj
)?It's in base.lproj folder and every other string in this file works fine
Can you paste what returns the following code?
debugPrint(L10n.shared)
Right now i can't test it, will answer tomorrow
L10n {
Language: en
Preferred language: en
Supported languages: ["Base", "ru", "en"]
Bundle: nil
}
In private func languageChanged(oldValue: String? = nil) you only looking for en.lproj, ignoring Base.lproj where actual localization is located
Yes you are right. As the language is set, files from this language are taken, while others are ignored.
A proposal to solve your problem:
base.lproj
to en.lproj
Base localization is used for all languages not currently supported. If i set french language, base localization will be used. This is iOS default behaviour. So fallback to base localization if localization for current language is not found seems pretty reasonable to me.
For me, this is not a bug, this is intentional behavior. If the application supports French and user set French, then why should it display text in English?
If app supports french, than it would be found by language in fr.lproj. I'm talking about behaviour when {language}.lproj is not found.
If {language}.lproj is not found then:
L10n.supportedLanguages
)L10n.preferredLanguage
)@Decybel07 from Apple documentation For example, if you select English as the development language, Xcode inserts the resource file in the Base.lproj project folder but not the en.lproj folder because the resource is already in English.
. At the end of the page https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/InternationalizingYourUserInterface/InternationalizingYourUserInterface.html
You convinced me, I'm going to add support for "base internacionalization"
@entropious, @Tsarfolk Problem is solved, the base internationalization is added to the library.
Just installed this pod and tried plural localization via
"eventCount".l10n(arg: count)
Added this lines to Localizable.stringsTraced code, self.bundle in this function is nil, so no resource is loaded
Version 5.1.0