feat: add translation for "Check for update" setting (#294)

This commit is contained in:
Serhiy Mytrovtsiy
2021-01-19 20:47:36 +01:00
parent 2786909e37
commit 5c2301d79f
22 changed files with 114 additions and 11 deletions

View File

@@ -91,7 +91,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
self.updateActivity.invalidate()
self.updateActivity.repeats = true
guard let updateInterval = AppUpdateIntervals(rawValue: store.string(key: "update-interval", defaultValue: AppUpdateIntervals.atStart.rawValue)) else {
guard let updateInterval = AppUpdateInterval(rawValue: store.string(key: "update-interval", defaultValue: AppUpdateInterval.atStart.rawValue)) else {
return
}
os_log(.debug, log: log, "Application update interval is '%s'", "\(updateInterval.rawValue)")

View File

@@ -2,9 +2,12 @@
// Localizable.strings
// Stats
//
//
//
// Created by @mpl75 on 11/01/2021.
//
//
//
// Words
"Unknown" = "Neznámý";
@@ -45,6 +48,11 @@
// Application settings
"Update application" = "Aktualizovat aplikaci";
"Check for updates" = "Zkontrolovat aktualizace";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Zkontrolovat aktualizace";
"Show icon in dock" = "Zobrazovat ikonu v Docku";
"Start at login" = "Spustit po přihlášení";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Applikation aktualisieren";
"Check for updates" = "Nach Updates suchen";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Nach Updates suchen";
"Show icon in dock" = "Symbol im Dock anzeigen";
"Start at login" = "Beim Login starten";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Update application";
"Check for updates" = "Check for updates";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Check for update";
"Show icon in dock" = "Show icon in dock";
"Start at login" = "Start at login";

View File

@@ -49,6 +49,11 @@
// Application settings
"Update application" = "Actualizar la aplicación";
"Check for updates" = "Buscar actualizaciones";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Buscar actualización";
"Show icon in dock" = "Muestra el icono en el dock";
"Start at login" = "Arrancar al iniciar sesión";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Mettre à jour l'application";
"Check for updates" = "Rechercher des mises à jour";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Vérifier la mise à jour";
"Show icon in dock" = "Afficher l'icône dans le dock";
"Start at login" = "Démarrer au lancement";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Aggiorna applicazione";
"Check for updates" = "Controlla aggiornamenti";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Controlla aggiornamento";
"Show icon in dock" = "Mostra icona nel dock";
"Start at login" = "Avvia al login";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "アプリをアップデートする";
"Check for updates" = "アップデートの確認頻度";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "アップデートを確認する";
"Show icon in dock" = "Dock にアイコンを表示";
"Start at login" = "ログイン時に開く";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "앱 업데이트";
"Check for updates" = "신규 업데이트 확인";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "신규 업데이트 확인";
"Show icon in dock" = "Dock에서 아이콘 보이기";
"Start at login" = "로그인시 시작";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Oppdater programmet";
"Check for updates" = "Se etter oppdateringer";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Se etter oppdatering";
"Show icon in dock" = "Vis ikon i dock";
"Start at login" = "Start ved innlogging";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Aktualizuj aplikacje";
"Check for updates" = "Sprawdzaj aktualizacje";
"At start" = "Przy uruchomieniu";
"Once per day" = "Raz dziennie";
"Once per week" = "Raz w tygodniu";
"Once per month" = "Raz na miesiąc";
"Never" = "Nigdy";
"Check for update" = "Sprawdź aktualizacje";
"Show icon in dock" = "Pokazuj ikonę w docku";
"Start at login" = "Uruchamiać przy logowaniu";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Atualizar aplicativo";
"Check for updates" = "Verificar se há atualizações";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Verificar atualização";
"Show icon in dock" = "Mostrar ícone no dock";
"Start at login" = "Inicie no login";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Atualizar aplicação";
"Check for updates" = "Procurar por atualizações";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Procurar atualização";
"Show icon in dock" = "Mostrar ícone na doca";
"Start at login" = "Iniciar durante login";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Обновить приложение";
"Check for updates" = "Проверять обновления";
"At start" = "При включении";
"Once per day" = "Раз в день";
"Once per week" = "Раз в неделю";
"Once per month" = "Раз в месяц";
"Never" = "Никогда";
"Check for update" = "Проверить обновление";
"Show icon in dock" = "Показать значок в dock";
"Start at login" = "Запуск при логуванні";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Uygulamayı güncelle";
"Check for updates" = "Güncellemeleri denetle";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Güncellemeleri denetle";
"Show icon in dock" = "Dock'ta göster";
"Start at login" = "Başlangıçta çalıştır";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Оновити програму";
"Check for updates" = "Перевіряти оновленя";
"At start" = "При включенні";
"Once per day" = "Раз на день";
"Once per week" = "Раз на тиждень";
"Once per month" = "Раз на місяць";
"Never" = "Ніколи";
"Check for update" = "Перевірити оновленя";
"Show icon in dock" = "Показувати іконку в dock";
"Start at login" = "Запускати при логуванні";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "Cập nhật ứng dụng";
"Check for updates" = "Kiểm tra các cập nhật";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "Kiểm tra cập nhật";
"Show icon in dock" = "Hiện icon trên Dock";
"Start at login" = "Khởi động lúc đăng nhập";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "更新应用";
"Check for updates" = "检查更新";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "检查更新";
"Show icon in dock" = "在dock显示图标";
"Start at login" = "登录时打开";

View File

@@ -48,6 +48,11 @@
// Application settings
"Update application" = "更新應用程式";
"Check for updates" = "檢查更新";
"At start" = "At start";
"Once per day" = "Once per day";
"Once per week" = "Once per week";
"Once per month" = "Once per month";
"Never" = "Never";
"Check for update" = "檢查更新";
"Show icon in dock" = "在 Dock 顯示圖示";
"Start at login" = "登入時打開";

View File

@@ -14,9 +14,9 @@ import StatsKit
import os.log
class ApplicationSettings: NSScrollView {
private var updateIntervalValue: AppUpdateInterval {
private var updateIntervalValue: String {
get {
return store.string(key: "update-interval", defaultValue: AppUpdateIntervals.atStart.rawValue)
return store.string(key: "update-interval", defaultValue: AppUpdateInterval.atStart.rawValue)
}
}
@@ -175,7 +175,7 @@ class ApplicationSettings: NSScrollView {
self.titleView(LocalizedString("Check for updates")),
SelectView(
action: #selector(self.toggleUpdateInterval),
items: AppUpdateIntervals.allCases.map{ KeyValue_t(key: $0.rawValue, value: $0.rawValue) },
items: AppUpdateIntervals,
selected: self.updateIntervalValue
)
]
@@ -270,10 +270,12 @@ class ApplicationSettings: NSScrollView {
}
@objc private func toggleUpdateInterval(_ sender: NSMenuItem) {
if let newUpdateInterval = AppUpdateIntervals(rawValue: sender.title) {
store.set(key: "update-interval", value: newUpdateInterval.rawValue)
NotificationCenter.default.post(name: .changeCronInterval, object: nil, userInfo: nil)
guard let key = sender.representedObject as? String else {
return
}
store.set(key: "update-interval", value: key)
NotificationCenter.default.post(name: .changeCronInterval, object: nil, userInfo: nil)
}
@objc private func toggleTemperatureUnits(_ sender: NSMenuItem) {

View File

@@ -91,7 +91,7 @@ extension AppDelegate {
NSApp.setActivationPolicy(dockIconStatus)
}
if AppUpdateIntervals(rawValue: store.string(key: "update-interval", defaultValue: AppUpdateIntervals.atStart.rawValue)) != .never {
if store.string(key: "update-interval", defaultValue: AppUpdateInterval.atStart.rawValue) != AppUpdateInterval.never.rawValue {
self.checkForNewVersion()
}
}

View File

@@ -11,8 +11,8 @@
import Cocoa
public typealias AppUpdateInterval = String
public enum AppUpdateIntervals: AppUpdateInterval {
public typealias AppUpdateIntervalType = String
public enum AppUpdateInterval: AppUpdateIntervalType {
case atStart = "At start"
case separator_1 = "separator_1"
case oncePerDay = "Once per day"
@@ -21,7 +21,15 @@ public enum AppUpdateIntervals: AppUpdateInterval {
case separator_2 = "separator_2"
case never = "Never"
}
extension AppUpdateIntervals: CaseIterable {}
public let AppUpdateIntervals: [KeyValue_t] = [
KeyValue_t(key: "At start", value: AppUpdateInterval.atStart.rawValue),
KeyValue_t(key: "separator_1", value: "separator_1"),
KeyValue_t(key: "Once per day", value: AppUpdateInterval.oncePerDay.rawValue),
KeyValue_t(key: "Once per week", value: AppUpdateInterval.oncePerWeek.rawValue),
KeyValue_t(key: "Once per month", value: AppUpdateInterval.oncePerMonth.rawValue),
KeyValue_t(key: "separator_2", value: "separator_2"),
KeyValue_t(key: "Never", value: AppUpdateInterval.never.rawValue)
]
public struct KeyValue_t {
public let key: String