Files
Dariusz Koryto 80dadb3194 feat(i18n): add Polish as an in-app locale (#473)
* feat(editor): add setting to turn off spellcheck underlines

Add a device-local "Underline spelling mistakes" switch to the editing
preferences. The rich-text editor and the mobile plain-text editor now
set spellcheck from this preference and update live when it changes.
Defaults to enabled, so existing behavior is unchanged.

Refs #468

* feat(i18n): add Polish as an in-app locale

Add Polish (pl) across clients, mirroring how Japanese was added:

- Shared: full pl catalog, locale matching for pl/pl-*, Polish memo
  templates and factory AI prompts, mobile editor strings, and Polish as
  an AI translation target and selection-translate chip.
- Web: "Polski" in the language picker; the catalog is lazy-loaded in its
  own i18n-pl chunk and kept out of the PWA precache like ja.
- Android: pl locale option, mobile-only strings, web-clip labels.
  Messages that only had an English branch now use English for every
  non-Chinese locale, so Japanese no longer falls back to Chinese there.
- iOS: .polish UI language (pl-PL), pl argument for every t() call,
  pl in CFBundleLocalizations and Localizable.xcstrings.
- Companion: accepts locale "pl" and detects Polish requests.
- Browser extension: _locales/pl messages.
- Marketing site: /pl/ pages, hreflang, sitemap, language switcher.
- Google Play listing copy for pl-PL (manual publish only).

* fix(ios): show the note editor in Polish and Japanese

The iOS editor received every interface language except English as
Chinese, so with Polish or Japanese selected its toolbar and image
gallery controls were labeled in Chinese. Pass Polish and Japanese
through to the embedded editor, label its toolbar and the shared image
gallery controls in both languages, and rebuild the checked-in
EditorBundle. The Android editor uses the same gallery labels.

Also translate the last iOS strings that had no Polish text: the
follow-system language label, note created/updated times and the
current-device marker.

Refs #473

* fix(companion): recognize Polish typed without diacritics

Requests in Latin letters without Polish diacritics were always treated
as English, so with a Polish interface "Napisz plan na jutro" got an
English reply. With a Polish interface, such text is now told apart by
common English and Polish words; when it is still unclear, the recent
conversation and then the interface language decide. Other interface
languages keep treating Latin text as English.

Refs #473

* chore(ios): regenerate the Xcode project for Polish

Run xcodegen so the shipped Info.plist lists Polish in
CFBundleLocalizations and the project knows the pl region. The
hand-written AiDirectStream.swift entries are replaced by the IDs
xcodegen generates. MARKETING_VERSION and CURRENT_PROJECT_VERSION stay
in the project file because the release script and Xcode Cloud update
them there.

Refs #473

* i18n(pl): translate the sidebar shortcut, desktop menus and video scope

Add Polish for features that reached main while this branch was open:
the show/hide sidebar shortcut label, the desktop application and
editing context menus, and the new "ai:generate" MCP scope. The desktop
menus switch to Polish for pl and pl-* locales; other locales are
unchanged.

Refs #473
2026-10-06 16:18:38 +08:00

121 lines
5.1 KiB
Swift

import SwiftUI
struct AccountPasswordPanel: View {
@Environment(AppEnvironment.self) private var env
@State private var currentPassword = ""
@State private var newPassword = ""
@State private var confirmPassword = ""
@State private var message: String?
@State private var isError = false
@State private var busy = false
var body: some View {
VStack(alignment: .leading, spacing: 14) {
HStack(alignment: .top, spacing: 10) {
Image(systemName: "key.fill")
.font(.system(size: 18, weight: .semibold))
.foregroundStyle(AppTheme.accentStrong)
.padding(.top, 2)
VStack(alignment: .leading, spacing: 3) {
Text(env.preferences.t("修改密码", en: "Change password", pl: "Zmień hasło"))
.font(.system(size: 16, weight: .heavy))
.foregroundStyle(AppTheme.title)
Text(env.preferences.t(
"修改后会保留当前设备登录,并退出其他设备上的登录会话。",
en: "Keeps this device signed in and signs out other sessions.",
pl: "To urządzenie pozostanie zalogowane, a pozostałe sesje zostaną wylogowane."
))
.font(.system(size: 12))
.foregroundStyle(AppTheme.secondary)
.fixedSize(horizontal: false, vertical: true)
}
}
passwordField(env.preferences.t("当前密码", en: "Current password", pl: "Bieżące hasło"), text: $currentPassword)
passwordField(env.preferences.t("新密码", en: "New password", pl: "Nowe hasło"), text: $newPassword)
passwordField(env.preferences.t("确认新密码", en: "Confirm password", pl: "Potwierdź hasło"), text: $confirmPassword)
if let message {
Text(message)
.font(.system(size: 13, weight: isError ? .regular : .bold))
.foregroundStyle(isError ? AppTheme.danger : AppTheme.accentStrong)
}
Button {
Task { await submit() }
} label: {
Text(busy
? env.preferences.t("正在修改…", en: "Updating…", pl: "Aktualizowanie…")
: env.preferences.t("修改密码", en: "Change password", pl: "Zmień hasło"))
.font(.system(size: 14, weight: .heavy))
.foregroundStyle(.white)
.frame(maxWidth: .infinity)
.frame(minHeight: 48)
.background(AppTheme.accentAction)
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
.opacity(busy ? 0.45 : 1)
}
.buttonStyle(.plain)
.disabled(busy)
}
.padding(16)
.padding(.bottom, 8)
.background(AppTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: 12, style: .continuous)
.stroke(AppTheme.border, lineWidth: 1)
)
}
private func passwordField(_ label: String, text: Binding<String>) -> some View {
VStack(alignment: .leading, spacing: 7) {
Text(label)
.font(.system(size: 13, weight: .bold))
.foregroundStyle(AppTheme.meta)
SecureField("", text: text)
.font(.system(size: 15))
.padding(.horizontal, 13)
.frame(minHeight: 48)
.background(AppTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 10, style: .continuous))
.overlay(
RoundedRectangle(cornerRadius: 10, style: .continuous)
.stroke(AppTheme.border, lineWidth: 1)
)
}
}
private func submit() async {
message = nil
isError = false
if newPassword.count < 8 {
isError = true
message = env.preferences.t("新密码至少需要 8 个字符", en: "Password must be at least 8 characters", pl: "Hasło musi mieć co najmniej 8 znaków")
return
}
if newPassword != confirmPassword {
isError = true
message = env.preferences.t("两次输入的新密码不一致", en: "Passwords do not match", pl: "Hasła nie są zgodne")
return
}
busy = true
defer { busy = false }
do {
try await env.session.client.changePassword(
current: currentPassword,
newPassword: newPassword,
confirm: confirmPassword
)
currentPassword = ""
newPassword = ""
confirmPassword = ""
isError = false
message = env.preferences.t("密码已修改成功。", en: "Password updated.", pl: "Zaktualizowano hasło.")
} catch {
isError = true
message = error.localizedDescription
}
}
}