Fix translations with country code not working
This commit is contained in:
parent
402b79f862
commit
3b5837a44e
@ -224,7 +224,7 @@ public enum Generation {
|
||||
) -> String {
|
||||
var result = "public func string(for language: String) -> String {\n"
|
||||
let languages = getLanguages(dictionary: dictionary)
|
||||
for language in languages where language != defaultLanguage {
|
||||
for language in languages.sorted().reversed() where language != defaultLanguage {
|
||||
result += indent("if language.hasPrefix(\"\(language)\") {", by: indentTwo)
|
||||
result += indent("\nreturn \(language)", by: indentThree)
|
||||
result += indent("\n} else", by: indentTwo)
|
||||
|
||||
@ -21,8 +21,7 @@ public enum System {
|
||||
guard let lang = ProcessInfo.processInfo.environment["LANG"] else {
|
||||
return "en"
|
||||
}
|
||||
let components = lang.split(separator: "_")
|
||||
systemLanguage = .init(components.first ?? "en")
|
||||
systemLanguage = lang
|
||||
#endif
|
||||
#if os(macOS)
|
||||
systemLanguage = Locale.preferredLanguages.first
|
||||
|
||||
@ -4,6 +4,7 @@ hello(name):
|
||||
en: Hello, (name)!
|
||||
de: Hallo, (name)!
|
||||
fr: Salut, (name)!
|
||||
pt_BR: Olá, (name)!
|
||||
|
||||
house:
|
||||
en: House
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user