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

105 lines
5.0 KiB
Swift

import SwiftUI
struct UsersManagementView: View {
@Environment(AppEnvironment.self) private var env
@State private var users: [InstanceUser] = []
@State private var username = ""
@State private var password = ""
@State private var error: String?
var body: some View {
VStack(spacing: 16) {
if let error {
Text(error).font(.system(size: 13)).foregroundStyle(AppTheme.danger)
.frame(maxWidth: .infinity, alignment: .leading)
}
VStack(spacing: 0) {
ForEach(Array(users.enumerated()), id: \.element.id) { index, user in
HStack {
VStack(alignment: .leading, spacing: 2) {
Text(user.displayName ?? user.username)
.font(.system(size: 14, weight: .bold))
Text("@\(user.username) · \(user.role)")
.font(.system(size: 12))
.foregroundStyle(AppTheme.secondary)
}
Spacer()
if user.isDisabled {
Text(env.preferences.t("已禁用", en: "Disabled", pl: "Wyłączony"))
.font(.system(size: 12, weight: .bold))
.foregroundStyle(AppTheme.danger)
}
if user.role != "owner" {
Button {
Task {
_ = try? await env.session.client.updateUser(
userId: user.id,
displayName: nil,
password: nil,
isDisabled: !user.isDisabled
)
users = (try? await env.session.client.listUsers()) ?? []
}
} label: {
Text(user.isDisabled
? env.preferences.t("启用", en: "Enable", pl: "Włącz")
: env.preferences.t("禁用", en: "Disable", pl: "Wyłącz"))
.font(.system(size: 13, weight: .bold))
}
}
}
.padding(16)
.overlay(alignment: .top) {
if index > 0 { Rectangle().fill(AppTheme.cardBorder).frame(height: 1) }
}
}
}
.background(AppTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(RoundedRectangle(cornerRadius: 12).stroke(AppTheme.border, lineWidth: 1))
VStack(alignment: .leading, spacing: 10) {
Text(env.preferences.t("创建成员", en: "Create member", pl: "Utwórz członka"))
.font(.system(size: 14, weight: .heavy))
TextField(env.preferences.t("用户名", en: "Username", pl: "Nazwa użytkownika"), text: $username)
.textInputAutocapitalization(.never)
.padding(.horizontal, 12)
.frame(height: 44)
.background(AppTheme.searchFill)
.clipShape(RoundedRectangle(cornerRadius: 8))
SecureField(env.preferences.t("密码", en: "Password", pl: "Hasło"), text: $password)
.padding(.horizontal, 12)
.frame(height: 44)
.background(AppTheme.searchFill)
.clipShape(RoundedRectangle(cornerRadius: 8))
Button {
Task {
do {
_ = try await env.session.client.createUser(
username: username, displayName: nil, password: password
)
username = ""
password = ""
users = try await env.session.client.listUsers()
} catch { self.error = error.localizedDescription }
}
} label: {
Text(env.preferences.t("创建", en: "Create", pl: "Utwórz"))
.font(.system(size: 14, weight: .heavy))
.foregroundStyle(.white)
.frame(maxWidth: .infinity)
.frame(height: 44)
.background(AppTheme.title)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
.buttonStyle(.plain)
}
.padding(16)
.background(AppTheme.card)
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(RoundedRectangle(cornerRadius: 12).stroke(AppTheme.border, lineWidth: 1))
}
.task { users = (try? await env.session.client.listUsers()) ?? [] }
}
}