Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

German in the Qt front end, the iOS note, float placeholders in the tests

v0lumehic3ed86cfd5a4
diff --git a/frontend-qt/nspb_qt/i18n.py b/frontend-qt/nspb_qt/i18n.py
index a1841526..8ed8dca9 100644
--- a/frontend-qt/nspb_qt/i18n.py
+++ b/frontend-qt/nspb_qt/i18n.py
@@ -3,6 +3,7 @@ from __future__ import annotations
import locale
import os
+import re
import sys
from enum import Enum
@@ -54,7 +55,7 @@ class Lang(Enum):
return Lang.ZH
if low.startswith('sv'):
return Lang.SV
- if low.startswith('de'):
+ if re.match(r'de($|[^a-z])', low):
return Lang.DE
if low: # a real code we do not translate: this device is neither
return Lang.EN
@@ -72,4 +73,4 @@ class Lang(Enum):
return Lang.ZH
if low.startswith('sv') or 'swedish' in low:
return Lang.SV
- return Lang.DE if low.startswith('de') or 'german' in low or 'deutsch' in low else Lang.EN
+ return Lang.DE if re.match(r'de($|[^a-z])', low) or 'german' in low or 'deutsch' in low else Lang.EN
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index 5ac85730..65c046f0 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -285,7 +285,7 @@ TABLE: dict[str, tuple[str, str, str, str]] = {
'cheats.dropHint': ('松开以导入金手指', 'Drop to import cheats', 'Släpp för att importera fusk', 'Zum Importieren der Cheats ablegen'),
'cheats.note': ('开关会立即保存,游戏下次启动时生效。', 'Switches are saved at once and apply the next time the game starts.', 'Reglagen sparas direkt och gäller nästa gång spelet startas.', 'Schalter werden sofort gesichert und gelten beim nächsten Start des Spiels.'),
'cheats.noteDevice': ('更改后请再次复制到 %@。', 'Copy to %@ again after a change.', 'Kopiera till %@ igen efter en ändring.', 'Kopiere nach einer Änderung erneut auf %@.'),
- 'cheats.iosNote': ('金手指在 Mac 版应用中可用。在 iPhone 和 iPad 上,游戏启动时它们会被关闭,因为 iOS 不允许修改游戏的代码(seedds/nxnative#724)。', "Cheats work in the Mac app. On iPhone and iPad they are turned off when the game starts, because iOS does not allow changing the game's code (seedds/nxnative#724).", 'Fusk fungerar i Mac-appen. På iPhone och iPad stängs det av när spelet startar, eftersom iOS inte tillåter att spelets kod ändras (seedds/nxnative#724).', "Cheats work in the Mac app. On iPhone and iPad they are turned off when the game starts, because iOS does not allow changing the game's code (seedds/nxnative#724)."),
+ 'cheats.iosNote': ('金手指在 Mac 版应用中可用。在 iPhone 和 iPad 上,游戏启动时它们会被关闭,因为 iOS 不允许修改游戏的代码(seedds/nxnative#724)。', "Cheats work in the Mac app. On iPhone and iPad they are turned off when the game starts, because iOS does not allow changing the game's code (seedds/nxnative#724).", 'Fusk fungerar i Mac-appen. På iPhone och iPad stängs det av när spelet startar, eftersom iOS inte tillåter att spelets kod ändras (seedds/nxnative#724).', 'Cheats funktionieren in der Mac-App. Auf iPhone und iPad sind sie beim Start des Spiels ausgeschaltet, weil iOS es nicht erlaubt, den Code des Spiels zu ändern (seedds/nxnative#724).'),
'pad.manage': ('管理', 'Manage', 'Hantera', 'Verwalten'),
'dev.signStage': ('为 %@ 签名', 'Sign for %@', 'Signerar för %@', 'Für %@ signieren'),
'dev.installStage': ('安装到 %@', 'Install on %@', 'Installerar på %@', 'Auf %@ installieren'),
diff --git a/frontend-qt/tests/test_localization_de.py b/frontend-qt/tests/test_localization_de.py
index bc63d4eb..087c4088 100644
--- a/frontend-qt/tests/test_localization_de.py
+++ b/frontend-qt/tests/test_localization_de.py
@@ -12,7 +12,7 @@ sys.path.insert(0, str(ROOT / 'frontend-qt'))
from nspb_qt.i18n import Lang # noqa: E402
from nspb_qt.localization import TABLE, t # noqa: E402
-PLACEHOLDER = re.compile(r'%(?:\d+\$)?(?:ll|l)?[@dsf%]')
+PLACEHOLDER = re.compile(r'%(?:\d+\$)?(?:\.\d+)?(?:ll|l)?[@dsf%]')
class German(unittest.TestCase):
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index f2f9b7c1..b5f6549c 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -2020,6 +2020,7 @@ enum L10n {
"cheats.dropHint": "Zum Importieren der Cheats ablegen",
"cheats.note": "Schalter werden sofort gesichert und gelten beim nächsten Start des Spiels.",
"cheats.noteDevice": "Kopiere nach einer Änderung erneut auf %@.",
+ "cheats.iosNote": "Cheats funktionieren in der Mac-App. Auf iPhone und iPad sind sie beim Start des Spiels ausgeschaltet, weil iOS es nicht erlaubt, den Code des Spiels zu ändern (seedds/nxnative#724).",
"pad.manage": "Verwalten",
"dev.signStage": "Für %@ signieren",
"dev.installStage": "Auf %@ installieren",
diff --git a/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift b/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
index d8f3ce97..794dae4f 100644
--- a/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
@@ -19,9 +19,9 @@ final class GermanLocalizationTests: XCTestCase {
"controls.fn.ZL", "controls.fn.ZR", "controls.fn.Plus", "controls.fn.Minus", "launch.mods",
]
- /// printf-style placeholders in order: %@, %d, %ld, %lld, positional %1$@, and %%.
+ /// printf-style placeholders in order: %@, %d, %ld, %lld, %.0f and %.1f, positional %1$@, and %%.
private func placeholders(_ s: String) -> [String] {
- let re = try! NSRegularExpression(pattern: "%(?:[0-9]+\\$)?(?:ll|l)?[@dsf%]")
+ let re = try! NSRegularExpression(pattern: "%(?:[0-9]+\\$)?(?:\\.[0-9]+)?(?:ll|l)?[@dsf%]")
return re.matches(in: s, range: NSRange(s.startIndex..., in: s)).map { String(s[Range($0.range, in: s)!]) }
}