diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e4cfcd3..1bdf807 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -125,7 +125,7 @@ jobs:
run: |
v="${GITHUB_REF_NAME#v}"
awk -v v="$v" '/^## /{p = index($0, "## " v) == 1; next} p' CHANGELOG.md > notes.md
- # The same news in Spanish, between markers the app reads to tell what a new version brings before updating.
+ # The same news in Spanish and English, between markers the app reads to tell what a new version brings before updating.
awk -v v="$v" '/^## /{p = $0 == "## " v; next} p' docs/novedades.md > es.md
if grep -q '^- ' es.md; then
{
@@ -139,6 +139,19 @@ jobs:
echo ""
} >> notes.md
fi
+ awk -v v="$v" '/^## /{p = $0 == "## " v; next} p' docs/novedades.en.md > en.md
+ if grep -q '^- ' en.md; then
+ {
+ echo
+ echo "What's new in English
"
+ echo
+ echo ""
+ cat en.md
+ echo ""
+ echo
+ echo " "
+ } >> notes.md
+ fi
base="https://github.com/${GITHUB_REPOSITORY}/releases/download/${GITHUB_REF_NAME}"
exe=$(cut -d' ' -f1 dist/Stackshot.exe.sha256)
msi=$(cut -d' ' -f1 dist/Stackshot.msi.sha256)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b8c9346..302de52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Unreleased
+- **English interface.** Stackshot follows the Windows language: English on an English Windows, and English can be chosen under Settings › General › Appearance › Language. Contributed by @altmashnaveed (PR #12).
- **Korean interface.** Select 한국어 in the language picker or use Automatic on Korean Windows. Existing language preferences are preserved. Contributed by @Hobeom (PR #30).
- **German, complete.** The German interface that arrived with PR #13 (by Aamer Shahzad) now covers the whole app: capture and the area picker, the editor, recording and the video tools, the desktop mascot included, the Home window, history, reports and the Markdown and XML viewers. Notices keep their kind in every language (their kind comes from the text's key, not from the words of one language), a document that is not UTF-8 is rescued the same in all languages, and shown numbers use each language's own thousands and decimal marks. The in-app news come in the interface language (Spanish, English, German and Korean).
- **Redaction independent of the interface language.** The recognizer that reads a capture and decides what to cover is chosen once per session without looking at the interface language, so the same capture is read and covered the same in every language. For redaction only Latin-script recognizers are accepted, and it fails closed: on a Windows with none, the automatic cover option stays off with an explanation instead of letting unchecked data through, while copy text and history search still use any installed recognizer. If a capture cannot be checked, it is discarded and a notice says why; if the recognizer stumbles, the queue recovers without losing what was waiting.
diff --git a/README.es.md b/README.es.md
index 0015bb0..8637b95 100644
--- a/README.es.md
+++ b/README.es.md
@@ -649,7 +649,7 @@ Al abrir `Stackshot.exe` te ofrece instalarlo para tu usuario (sin permisos de a
¿Tiene la interfaz en español?
-Sí: en español, inglés, alemán y coreano. Una instalación nueva sigue el idioma de Windows (coreano en un Windows en coreano; español en un Windows en español, catalán, gallego o euskera; alemán en uno alemán; inglés en los demás), y **Ajustes › General › Apariencia › Idioma** lo cambia al momento (Automático, Español, English, Deutsch, 한국어), durante la instalación o desde la bandeja. Quien ya usaba Stackshot sigue en español mientras no elija otro. Francés, portugués, chino simplificado, hindi, árabe y bengalí se ofrecen como vista previa: traducen el selector de idioma y los controles comunes, y el resto queda en inglés; los textos que falten en coreano se muestran en inglés. La traducción al inglés la aportó [@altmashnaveed](https://github.com/altmashnaveed) y la del coreano [@Hobeom](https://github.com/Hobeom); el alemán y la redacción de claves vinieron de la PR #13 de [@aamershahzad2](https://github.com/aamershahzad2).
+Sí: en español, inglés, alemán y coreano. Una instalación nueva sigue el idioma de Windows (coreano en un Windows en coreano; español en un Windows en español, catalán, gallego o euskera; alemán en uno alemán; inglés en los demás), y **Ajustes › General › Apariencia › Idioma** lo cambia al momento (Automático, Español, English, Deutsch, 한국어), durante la instalación o desde la bandeja. Quien ya usaba Stackshot sigue en español; si su Windows está en otro idioma, se le ofrece una sola vez el que corresponde, y no cambia nada si no lo acepta. Francés, portugués, chino simplificado, hindi, árabe y bengalí se ofrecen como vista previa: traducen el selector de idioma y los controles comunes, y el resto queda en inglés; los textos que falten en coreano se muestran en inglés. La traducción al inglés la aportó [@altmashnaveed](https://github.com/altmashnaveed) y la del coreano [@Hobeom](https://github.com/Hobeom); el alemán y la redacción de claves vinieron de la PR #13 de [@aamershahzad2](https://github.com/aamershahzad2).
## Compilar desde el código
diff --git a/README.md b/README.md
index a68efb9..f07a2ce 100644
--- a/README.md
+++ b/README.md
@@ -649,7 +649,7 @@ Running `Stackshot.exe` offers to install it for your user (no administrator rig
Is there an English interface?
-Yes. Stackshot speaks Spanish, English, German and Korean. A new installation follows the Windows display language (Korean on a Korean Windows; Spanish on a Spanish, Catalan, Galician or Basque Windows; German on a German one; English everywhere else), and **Settings › General › Appearance › Language** switches it at once (Automatic, Español, English, Deutsch, 한국어), at setup or from the tray. Those who already used Stackshot keep Spanish until they choose otherwise. French, Portuguese, Simplified Chinese, Hindi, Arabic and Bengali are offered as previews: they translate the language picker and the common controls, and the rest stays in English; any Korean text still missing is shown in English. The English translation was contributed by [@altmashnaveed](https://github.com/altmashnaveed) and the Korean one by [@Hobeom](https://github.com/Hobeom); German and the secrets redaction came from PR #13 by [@aamershahzad2](https://github.com/aamershahzad2).
+Yes. Stackshot speaks Spanish, English, German and Korean. A new installation follows the Windows display language (Korean on a Korean Windows; Spanish on a Spanish, Catalan, Galician or Basque Windows; German on a German one; English everywhere else), and **Settings › General › Appearance › Language** switches it at once (Automatic, Español, English, Deutsch, 한국어), at setup or from the tray. Those who already used Stackshot keep Spanish; if their Windows is in another language, the matching language is offered once, and nothing changes unless they accept. French, Portuguese, Simplified Chinese, Hindi, Arabic and Bengali are offered as previews: they translate the language picker and the common controls, and the rest stays in English; any Korean text still missing is shown in English. The English translation was contributed by [@altmashnaveed](https://github.com/altmashnaveed) and the Korean one by [@Hobeom](https://github.com/Hobeom); German and the secrets redaction came from PR #13 by [@aamershahzad2](https://github.com/aamershahzad2).
## Building from source
diff --git a/docs/new-features-tutorial.md b/docs/new-features-tutorial.md
index 7ad83e1..100fbed 100644
--- a/docs/new-features-tutorial.md
+++ b/docs/new-features-tutorial.md
@@ -1,6 +1,6 @@
# Stackshot: New Features Guide & Tutorial
-This guide provides a walkthrough of the new features added in the `feature/multi-language-support` release, explaining what each feature does, how to use it, and how it protects your sensitive information and speeds up your workflow.
+This guide provides a walkthrough of the language features that arrive with Stackshot 2.2.2, explaining what each feature does, how to use it, and how it protects your sensitive information and speeds up your workflow.
---
@@ -15,6 +15,7 @@ Stackshot adds **German (Deutsch)** alongside English and Spanish, and it is com
- Korean Windows (`ko-KR`) -> Korean (`ko`)
- Spanish Windows (`es-ES`, `es-MX`, `ca-ES`, `gl-ES`, `eu-ES`) -> Spanish (`es`)
- All other display languages -> English (`en`)
+- **One-time offer**: If you already used Stackshot in Spanish and your Windows is in another language, Stackshot offers the matching language once in a notice; nothing changes unless you accept, and you can always change it later in the settings.
- **Settings Selector**: Under **Settings › General › Appearance › Language**, open the picker and search by name or language code. Choose a language and select **Apply language**.
- **Preview languages**: French, Portuguese, Simplified Chinese, Hindi, Arabic and Bengali translate the picker and common controls. Other text appears in English. Select these languages manually. Automatic mode continues to choose Spanish, German, Korean or English based on Windows.
diff --git a/docs/novedades.de.md b/docs/novedades.de.md
index 8b1d2a6..84d3af6 100644
--- a/docs/novedades.de.md
+++ b/docs/novedades.de.md
@@ -7,7 +7,13 @@ Format: ein Abschnitt `## X.Y.Z` pro Version und darin eine Zeile pro Neuerung:
## 2.2.2
-- **Oberfläche auf Koreanisch.** In diesem Entwicklungs-Build kannst du 한국어 unter Einstellungen › Allgemein › Erscheinungsbild › Sprache wählen. Der Automatikmodus erkennt Windows auf Koreanisch, und eine selbst gewählte Sprache bleibt erhalten.
+- **Oberfläche auf Englisch.** Stackshot folgt der Windows-Sprache: Eine neue Installation auf einem englischen Windows startet auf Englisch. Ändern kannst du das unter Einstellungen › Allgemein › Erscheinungsbild › Sprache.
+- **Deutsch, vollständig.** Deutsch deckt jetzt die ganze App ab: Aufnahme, Editor, Aufzeichnung, das Maskottchen, Startseite, Verlauf und Berichte.
+- **Oberfläche auf Koreanisch.** Wähle 한국어 unter Einstellungen › Allgemein › Erscheinungsbild › Sprache. Danke an @Hobeom für die Übersetzung.
+- **Neue Sprachauswahl.** Suche Sprachen nach Name oder Code und erkenne, ob die Übersetzung vollständig oder nur eine Vorschau ist.
+- **Automatische Sprache und ein einmaliges Angebot.** Automatisch folgt der Windows-Sprache (Spanisch, Englisch, Deutsch oder Koreanisch). Wenn du Stackshot schon auf Spanisch benutzt hast und Windows in einer anderen Sprache läuft, wird dir die passende Sprache einmal angeboten; wenn du nicht zustimmst, ändert sich nichts.
+- **Sprachen als Vorschau.** Französisch, Portugiesisch, vereinfachtes Chinesisch, Hindi, Arabisch und Bengalisch erscheinen in der Auswahl als Vorschau: Die häufigsten Wörter sind übersetzt, der Rest bleibt Englisch.
+- **Sensible Daten in jeder Sprache abgedeckt.** Sensible Daten in einer Aufnahme zu finden und abzudecken funktioniert gleich, egal welche Oberflächensprache eingestellt ist.
## 2.2.1
@@ -20,7 +26,7 @@ Format: ein Abschnitt `## X.Y.Z` pro Version und darin eine Zeile pro Neuerung:
## 2.2.0
-- **Hintergründe wie CleanShot X.** Im Editor öffnet die Schaltfläche Fondo ein Seitenfenster: Verläufe, dein Desktop-Hintergrund und eigene Bilder, die Aufnahme selbst weichgezeichnet, einfarbige und jede andere Farbe, dazu Regler für Rand, Einrückung (mit automatischem Ausgleich), Schatten und Ecken sowie Ausrichtung und Seitenverhältnis.
+- **Hintergründe wie CleanShot X.** Im Editor öffnet die Schaltfläche Hintergrund ein Seitenfenster: Verläufe, dein Desktop-Hintergrund und eigene Bilder, die Aufnahme selbst weichgezeichnet, einfarbige und jede andere Farbe, dazu Regler für Rand, Einrückung (mit automatischem Ausgleich), Schatten und Ecken sowie Ausrichtung und Seitenverhältnis.
- **Zieh mich.** In der unteren Leiste des Editors gibt es einen Griff, um die Aufnahme per Ziehen in einen Chat, eine E-Mail oder eine andere App zu tragen.
- **Vor dem Aufnehmen anpassen.** Eine Option (standardmäßig aus), um den Bereich mit einer Vorschau zu verschieben und anzupassen, bevor aufgenommen wird.
- **Schärfere Texte.** In jedem Fenster, in den Menüs und im Hinweis der Bereichsauswahl, die jetzt jede Taste in ihrer eigenen Farbe malt.
diff --git a/docs/novedades.en.md b/docs/novedades.en.md
index 28e9758..f42e494 100644
--- a/docs/novedades.en.md
+++ b/docs/novedades.en.md
@@ -7,7 +7,13 @@ Format: one `## X.Y.Z` section per version and, in it, one line per item: `- **T
## 2.2.2
-- **Korean interface.** In this development build you can choose 한국어 under Settings › General › Appearance › Language. Automatic mode recognizes Windows in Korean, and the language you chose yourself is kept.
+- **English interface.** Stackshot follows your Windows language: a new installation on an English Windows opens in English. You can change it under Settings › General › Appearance › Language.
+- **German, complete.** German now covers the whole app: capture, editor, recording, the mascot, Home, history and reports.
+- **Korean interface.** Choose 한국어 under Settings › General › Appearance › Language. Thanks to @Hobeom for the translation.
+- **New language picker.** Search languages by name or code and check whether a translation is complete or a preview.
+- **Automatic language and a one-time offer.** Automatic follows the Windows language (Spanish, English, German or Korean). If you already used Stackshot in Spanish on a Windows in another language, you are offered the matching language once; if you do not accept, nothing changes.
+- **Preview languages.** French, Portuguese, Simplified Chinese, Hindi, Arabic and Bengali appear in the picker as previews: the most common words are translated and the rest stays in English.
+- **Sensitive data covered in any language.** Finding and covering the sensitive data in a capture works the same whatever the interface language is.
## 2.2.1
@@ -20,7 +26,7 @@ Format: one `## X.Y.Z` section per version and, in it, one line per item: `- **T
## 2.2.0
-- **Backdrops like CleanShot X.** In the editor, the Fondo button opens a side panel: gradients, your desktop wallpaper and your own pictures, the capture itself blurred, plain colours and any other colour, plus sliders for margin, inset (with auto-balancing), shadow and corners, and alignment and proportion.
+- **Backdrops like CleanShot X.** In the editor, the Backdrop button opens a side panel: gradients, your desktop wallpaper and your own pictures, the capture itself blurred, plain colours and any other colour, plus sliders for margin, inset (with auto-balancing), shadow and corners, and alignment and proportion.
- **Drag me.** The editor's bottom bar has a handle to carry the capture dragging to a chat, an email or another app.
- **Adjust before capturing.** An option (off by default) to move and adjust the area with a preview before capturing.
- **Sharper text.** In every window, the menus and the area picker's notice, which now paints each key in its own colour.
diff --git a/docs/novedades.ko.md b/docs/novedades.ko.md
index 18e0f86..e2f7108 100644
--- a/docs/novedades.ko.md
+++ b/docs/novedades.ko.md
@@ -2,7 +2,13 @@
## 2.2.2
-- **한국어 인터페이스.** 이 개발 빌드에서는 설정 > 일반 > 화면 모양 > 언어에서 한국어를 선택할 수 있습니다. 자동 모드는 한국어 Windows를 인식하며, 직접 지정한 언어는 재시작 후에도 유지됩니다.
+- **영어 인터페이스.** Stackshot은 Windows 언어를 따릅니다. 영어 Windows에 새로 설치하면 영어로 열립니다. 설정 > 일반 > 화면 모양 > 언어에서 바꿀 수 있습니다.
+- **독일어 번역 완료.** 이제 캡처, 편집기, 녹화, 마스코트, 홈, 기록, 보고서까지 앱 전체를 독일어로 사용할 수 있습니다.
+- **한국어 인터페이스.** 설정 > 일반 > 화면 모양 > 언어에서 한국어를 선택할 수 있습니다. 번역해 주신 @Hobeom 님께 감사드립니다.
+- **새 언어 선택기.** 이름이나 코드로 언어를 검색하고, 번역이 완료되었는지 미리 보기인지 확인할 수 있습니다.
+- **자동 언어와 한 번만 나오는 제안.** 자동 모드는 Windows 언어(스페인어, 영어, 독일어, 한국어)를 따릅니다. 이미 스페인어로 Stackshot을 쓰고 있는데 Windows가 다른 언어라면 맞는 언어로 바꿀지 한 번만 묻습니다. 수락하지 않으면 아무것도 바뀌지 않습니다.
+- **미리 보기 언어.** 프랑스어, 포르투갈어, 중국어 간체, 힌디어, 아랍어, 벵골어는 선택기에 미리 보기로 표시됩니다. 자주 쓰는 표현만 번역되고 나머지는 영어로 보입니다.
+- **어떤 언어에서도 민감한 정보 가림.** 인터페이스 언어와 관계없이 캡처에서 민감한 정보를 찾아 가리는 방식은 같습니다.
## 2.2.1
diff --git a/docs/novedades.md b/docs/novedades.md
index 5bb44f3..0a28b41 100644
--- a/docs/novedades.md
+++ b/docs/novedades.md
@@ -7,7 +7,13 @@ Formato: una sección `## X.Y.Z` por versión y, en ella, una línea por novedad
## 2.2.2
-- **Interfaz en coreano.** En esta compilación de desarrollo puedes elegir 한국어 en Ajustes > General > Apariencia > Idioma. El modo automático reconoce Windows en coreano y se mantiene el idioma que ya hayas elegido.
+- **Interfaz en inglés.** Stackshot sigue el idioma de Windows: una instalación nueva en un Windows en inglés se abre en inglés. Puedes cambiarlo en Ajustes > General > Apariencia > Idioma.
+- **Alemán completo.** El alemán cubre ya toda la aplicación: captura, editor, grabación, la mascota, Inicio, el historial y los informes.
+- **Interfaz en coreano.** Elige 한국어 en Ajustes > General > Apariencia > Idioma. Gracias a @Hobeom por la traducción.
+- **Selector de idioma nuevo.** Busca el idioma por nombre o por código y comprueba si su traducción está completa o es una vista previa.
+- **Idioma automático y una oferta única.** El modo automático sigue el idioma de Windows (español, inglés, alemán o coreano). Si ya usabas Stackshot en español en un Windows en otro idioma, se te ofrece una sola vez el idioma que corresponde; si no aceptas, no cambia nada.
+- **Idiomas en vista previa.** Francés, portugués, chino simplificado, hindi, árabe y bengalí aparecen en el selector como vista previa: traducen lo más común y el resto sigue en inglés.
+- **Datos sensibles tapados en cualquier idioma.** Detectar y tapar los datos sensibles de una captura funciona igual sea cual sea el idioma de la interfaz.
## 2.2.1
diff --git a/docs/screens/language-ko.png b/docs/screens/language-ko.png
deleted file mode 100644
index 234e212..0000000
Binary files a/docs/screens/language-ko.png and /dev/null differ
diff --git a/docs/screens/settings-ko.png b/docs/screens/settings-ko.png
deleted file mode 100644
index 34eeb1c..0000000
Binary files a/docs/screens/settings-ko.png and /dev/null differ
diff --git a/src/Home/HomeDashboard.cs b/src/Home/HomeDashboard.cs
index c0a906f..f8595ed 100644
--- a/src/Home/HomeDashboard.cs
+++ b/src/Home/HomeDashboard.cs
@@ -309,10 +309,9 @@ FrameworkElement UpdateCard()
np.Children.Add(nt);
text.Children.Add(np);
}
- // What the new version brings: its Spanish news when the release has them, its headlines otherwise.
+ // What the new version brings, in the interface language (see Updater.Release.Items).
List heads = new List();
- if (r != null) { foreach (News.Item it in r.News) if (heads.Count < 5) heads.Add(it.Title); }
- if (r != null && heads.Count == 0) heads.AddRange(r.Notes);
+ if (r != null) { foreach (News.Item it in r.Items()) if (heads.Count < 5) heads.Add(it.Title); }
if (r != null && !working && heads.Count > 0)
{
StackPanel notes = new StackPanel { Margin = new Thickness(0, 10, 0, 0) };
diff --git a/src/Home/HomePages.cs b/src/Home/HomePages.cs
index de3a237..63a1348 100644
--- a/src/Home/HomePages.cs
+++ b/src/Home/HomePages.cs
@@ -878,7 +878,7 @@ void BuildGeneral()
new SegRow(I18n.T("Guardar las temporales", "Temporary captures retention"), I18n.T("Cu\u00E1nto duran las capturas que no guardas en tu carpeta.", "How long unsaved captures remain."), "stack", Mac.Teal, Mac.Blue,
new string[] { I18n.T("1 hora", "1 hour", "1 Stunde"), I18n.T("Al cerrar", "On close", "Beim Schließen"),
I18n.T("1 d\u00EDa", "1 day", "1 Tag"), I18n.T("7 d\u00EDas", "7 days", "7 Tage"), I18n.T("30 d\u00EDas", "30 days", "30 Tage") },
- delegate { return settings.TempKeep; }, delegate(int i) { settings.TempKeep = i; owner.Sweep(); }),
+ delegate { return settings.TempKeep; }, delegate(int i) { settings.TempKeep = i; owner.Sweep(); }) { Stacked = true },
new ButtonRow(I18n.T("Borrar recientes", "Clear recents"), I18n.T("Quita las capturas temporales; las de tu carpeta no se tocan.", "Removes temporary captures; saved files are untouched."), "trash", Mac.Red, Mac.Orange, I18n.T("Borrar", "Clear"), ClearRecent),
recovered);
Group(I18n.T("Al capturar", "When capturing"),
diff --git a/src/I18n.German.App.cs b/src/I18n.German.App.cs
index a432569..f893d8b 100644
--- a/src/I18n.German.App.cs
+++ b/src/I18n.German.App.cs
@@ -56,7 +56,7 @@ static void RegisterGermanApp(Action reg)
reg("Videos|", "V\u00EDdeos|", "Videos|");
reg("All files", "Todos los archivos", "Alle Dateien");
reg("Pasted", "Pegada", "Eingef\u00FCgt");
- reg("Could not save to your folder", "No se pudo guardar en tu carpeta", "In deinem Ordner konnte nicht gespeichert werden");
+ reg("Could not save to your folder", "No se pudo guardar en tu carpeta", "Nicht im Ordner gespeichert");
reg(" The thumbnail remains in the stack: you can copy it or save it to your folder.", " La miniatura sigue en la pila: puedes copiarla o guardarla en tu carpeta.", " Die Miniaturansicht bleibt im Stapel: du kannst sie kopieren oder in deinem Ordner speichern.");
reg(" The thumbnail remains in the stack: you can click Save again.", " La miniatura sigue en la pila: puedes volver a pulsar Guardar.", " Die Miniaturansicht bleibt im Stapel: du kannst erneut auf Speichern klicken.");
reg("Stackshot closed while recording{0}. The recording is safe", "Stackshot se cerr\u00F3 mientras grababa{0}. Lo grabado est\u00E1 a salvo", "Stackshot wurde mitten in einer Aufnahme beendet{0}. Die Aufnahme ist in Sicherheit");
@@ -132,7 +132,7 @@ static void RegisterGermanApp(Action reg)
reg("I cannot find that folder or file.", "No encuentro esa carpeta o ese archivo.", "Diesen Ordner oder diese Datei finde ich nicht.");
reg("Noted, with {0}.", "Apuntado, con {0}.", "Notiert, mit {0}.");
reg("Note saved.", "Nota guardada.", "Notiz gespeichert.");
- reg("Could not add note", "No se pudo apuntar", "Die Notiz konnte nicht gespeichert werden");
+ reg("Could not add note", "No se pudo apuntar", "Notiz nicht gespeichert");
reg("Could not update note", "No se pudo cambiar la nota", "Die Notiz konnte nicht ge\u00E4ndert werden");
reg("That note changed in Notas.md: open it to see it.", "Esa nota ha cambiado en Notas.md: \u00E1brela para verla.", "Diese Notiz hat sich in Notas.md ge\u00E4ndert: \u00F6ffne sie, um sie zu sehen.");
reg("That note is no longer in Notas.md (it was deleted or changed outside).", "Esa nota ya no est\u00E1 en Notas.md (se borr\u00F3 o cambi\u00F3 fuera).", "Diese Notiz ist nicht mehr in Notas.md (gel\u00F6scht oder au\u00DFerhalb ge\u00E4ndert).");
@@ -352,7 +352,7 @@ static void RegisterGermanApp(Action reg)
reg("Copied in HD", "Copiado en HD", "In HD kopiert");
reg("Reading\u2026", "Leyendo\u2026", "Wird gelesen\u2026");
reg("Could not read", "No se pudo leer", "Konnte nicht gelesen werden");
- reg("Could not pin capture", "No se pudo fijar la captura", "Die Aufnahme konnte nicht angeheftet werden");
+ reg("Could not pin capture", "No se pudo fijar la captura", "Anheften nicht möglich");
reg("Could not read the image. Please try again.", "No se ha podido leer la imagen. Vuelve a intentarlo.", "Das Bild konnte nicht gelesen werden. Versuch es bitte erneut.");
reg("Please try again.", "Vuelve a intentarlo.", "Versuch es bitte erneut.");
reg("Could not show", "No se pudo mostrar", "Konnte nicht angezeigt werden");
diff --git a/src/I18n.German.Editor.cs b/src/I18n.German.Editor.cs
index 5607f60..1635b6c 100644
--- a/src/I18n.German.Editor.cs
+++ b/src/I18n.German.Editor.cs
@@ -210,7 +210,7 @@ static void RegisterGermanEditor(Action reg)
reg("Playing · Space pauses", null, "Wiedergabe · Leertaste pausiert");
reg(" · visible throughout video", null, " · im gesamten Video sichtbar");
reg("Could not save: ", null, "Speichern fehlgeschlagen: ");
- reg("Could not save edit", null, "Änderungen konnten nicht gespeichert werden");
+ reg("Could not save edit", null, "Änderungen nicht gespeichert");
reg("Saving {0}…", null, "{0} wird gespeichert…");
reg("Saved: {0}", null, "Gespeichert: {0}");
reg("Could not copy: ", null, "Kopieren fehlgeschlagen: ");
diff --git a/src/I18n.German.Home.cs b/src/I18n.German.Home.cs
index 3daa8b8..c86a11f 100644
--- a/src/I18n.German.Home.cs
+++ b/src/I18n.German.Home.cs
@@ -94,9 +94,9 @@ static void RegisterGermanHome(Action reg)
reg("{0} results", "{0} resultados", "{0} Ergebnisse");
reg("1 item", "1 elemento", "1 Element");
reg("{0} items", "{0} elementos", "{0} Elemente");
- reg("{0} cannot be opened in the editor.", " no se puede abrir en el editor.", "{0} l\u00E4sst sich im Editor nicht \u00F6ffnen.");
+ reg("{0} cannot be opened in the editor.", null, "{0} l\u00E4sst sich im Editor nicht \u00F6ffnen.");
reg("Capture not found", "No se encuentra la captura", "Aufnahme nicht gefunden");
- reg("{0} is no longer in its folder: moved or deleted.", " ya no est\u00E1 en su carpeta: se ha movido o borrado.", "{0} ist nicht mehr in seinem Ordner: verschoben oder gel\u00F6scht.");
+ reg("{0} is no longer in its folder: moved or deleted.", null, "{0} ist nicht mehr in seinem Ordner: verschoben oder gel\u00F6scht.");
reg(" While search remains on, Stackshot will gradually re-read them.", " Mientras la b\u00FAsqueda siga activada, Stackshot volver\u00E1 a leerlas poco a poco.", " Bei eingeschalteter Suche liest Stackshot sie nach und nach erneut.");
reg("Delete text index?", "\u00BFBorrar el \u00EDndice de texto?", "Textindex l\u00F6schen?");
reg("Your captures are untouched.", "Tus capturas no se tocan.", "Deine Aufnahmen bleiben unber\u00FChrt.");
@@ -331,8 +331,8 @@ static void RegisterGermanHome(Action reg)
reg("Month, like {0}", "El mes, como {0}", "Monat, etwa {0}");
reg("Day, like {0}", "El d\u00EDa, como {0}", "Tag, etwa {0}");
reg("Sequential unique number: 1, 2, 3\u2026 (with {date}, resets daily)", "Un n\u00FAmero que no se repite: 1, 2, 3\u2026 (con {fecha}, empieza cada d\u00EDa)", "Fortlaufende Nummer: 1, 2, 3\u2026 (mit {date} beginnt sie jeden Tag neu)");
- reg("{0} is not one of the tokens above: kept as-is.", " no es ninguno de los de arriba: se queda tal cual.", "{0} geh\u00F6rt zu keinem der Platzhalter oben: bleibt unver\u00E4ndert.");
- reg("{0} are not tokens above: kept as-is.", " no son de los de arriba: se quedan tal cual.", "{0} sind keine der Platzhalter oben: bleiben unver\u00E4ndert.");
+ reg("{0} is not one of the tokens above: kept as-is.", null, "{0} geh\u00F6rt zu keinem der Platzhalter oben: bleibt unver\u00E4ndert.");
+ reg("{0} are not tokens above: kept as-is.", null, "{0} sind keine der Platzhalter oben: bleiben unver\u00E4ndert.");
reg("\\ / : * ? \" < > | are invalid in file names: replaced with _.", "\\ / : * ? \" < > | no valen en un nombre de archivo: se cambian por _.", "\\ / : * ? \" < > | sind in Dateinamen unzul\u00E4ssig: werden durch _ ersetzt.");
reg("If left empty, default file name is used.", "Si lo dejas vac\u00EDo, se usa el nombre de siempre.", "Ist das Feld leer, wird der gewohnte Name verwendet.");
reg("Without {time} or {n}, duplicate names will append (2), (3)\u2026 at the end.", "Sin {hora} ni {n}, las capturas que se llamen igual llevar\u00E1n (2), (3)\u2026 al final.", "Ohne {time} oder {n} bekommen gleichnamige Aufnahmen (2), (3)\u2026 ans Ende angeh\u00E4ngt.");
diff --git a/src/I18n.German.MascotHome.cs b/src/I18n.German.MascotHome.cs
index d9ea4c8..1df0e53 100644
--- a/src/I18n.German.MascotHome.cs
+++ b/src/I18n.German.MascotHome.cs
@@ -300,6 +300,8 @@ static void RegisterGermanMascotHome(Action reg)
reg("Sip by sip\u2026", "Sorbo a sorbo…", "Schluck für Schluck …");
reg("Look at something far away, over 20 feet\u2026 {0}", "Mira algo lejano, a más de 6 metros… {0}", "Schau etwas in der Ferne an, über 6 Meter entfernt … {0}");
reg("Done!", "¡Listo!", "Fertig!");
+ reg("Coming right up!", "¡Marchando!", "Kommt sofort!");
+ reg("Here it goes!", "¡Ahí va!", "Los geht's!");
reg("Arms up and stretch your back\u2026 {0} of 3", "Brazos arriba y estira la espalda… {0} de 3", "Arme hoch und streck den Rücken … {0} von 3");
reg("Squat {0} of 8", "Sentadilla {0} de 8", "Kniebeuge {0} von 8");
reg("Breathe in slowly through your nose\u2026 {0} of 6", "Inspira despacio por la nariz… {0} de 6", "Atme langsam durch die Nase ein … {0} von 6");
diff --git a/src/I18n.German.cs b/src/I18n.German.cs
index d00e629..f5bc6c7 100644
--- a/src/I18n.German.cs
+++ b/src/I18n.German.cs
@@ -156,7 +156,7 @@ static Tuple, Dictionary> BuildGerman
reg("Show options", null, "Optionen anzeigen");
reg("A gentle camera shutter sound on capture.", null, "Spielt beim Aufnehmen einen leisen Kameraton ab.");
reg("Ready to paste immediately with Ctrl+V; videos and GIFs as files.", null, "Sofort mit Strg+V einfügen. Videos und GIFs werden als Dateien kopiert.");
- reg("Auto-hide thumbnails", null, "Miniaturansichten automatisch ausblenden");
+ reg("Auto-hide thumbnails", null, "Miniaturansichten ausblenden");
reg("When unused, tuck thumbnails into screen edge until hovered.", null, "Schiebt Miniaturansichten an den Bildschirmrand, bis der Mauszeiger darübersteht.");
reg("Never", null, "Nie");
reg("After 3 s", null, "Nach 3 s");
@@ -359,7 +359,7 @@ static Tuple, Dictionary> BuildGerman
reg("Download and install", null, "Herunterladen und installieren");
reg("Updates are managed by IT on this computer: request the latest Stackshot.msi.", null, "Die IT verwaltet die Updates auf diesem Computer. Bitte frag nach der neuesten Stackshot.msi.");
reg("On this machine updates are managed by IT. Would you like to view the new version?", null, "Die IT verwaltet die Updates auf diesem Computer. Möchtest du dir die neue Version ansehen?");
- reg("Could not save capture", null, "Aufnahme konnte nicht gespeichert werden");
+ reg("Could not save capture", null, "Aufnahme nicht gespeichert");
reg("The capture was discarded because it could not be checked for sensitive data.", null, "Die Aufnahme wurde verworfen, weil sie nicht auf sensible Daten geprüft werden konnte.");
reg("Checking data\u2026", null, "Daten werden geprüft\u2026");
reg("Unchecked", null, "Ungeprüft");
diff --git a/src/I18n.Korean.Capture.cs b/src/I18n.Korean.Capture.cs
index 98cb9ac..f520db8 100644
--- a/src/I18n.Korean.Capture.cs
+++ b/src/I18n.Korean.Capture.cs
@@ -353,7 +353,6 @@ static void RegisterKoreanCapture(Dictionary map)
// Webcam
map["Connecting the camera\u2026"] = "\uCE74\uBA54\uB77C\uC5D0 \uC5F0\uACB0 \uC911\u2026";
map["Cannot open the camera"] = "\uCE74\uBA54\uB77C\uB97C \uC5F4 \uC218 \uC5C6\uC74C";
- map["No camera found"] = "\uCE74\uBA54\uB77C\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C";
map["no image for {0} s"] = "{0}\uCD08 \uB3D9\uC548 \uC601\uC0C1 \uC5C6\uC74C";
map["no response in {0} s"] = "{0}\uCD08 \uB3D9\uC548 \uC751\uB2F5 \uC5C6\uC74C";
map["FFmpeg closed"] = "FFmpeg \uC885\uB8CC\uB428";
diff --git a/src/I18n.Korean.Core.cs b/src/I18n.Korean.Core.cs
index 436c596..b0d5929 100644
--- a/src/I18n.Korean.Core.cs
+++ b/src/I18n.Korean.Core.cs
@@ -382,9 +382,9 @@ static void RegisterKoreanCore(Dictionary map)
map["The capture was discarded because it could not be checked for sensitive data."] = "\uBBFC\uAC10\uC815\uBCF4\uB97C \uAC80\uC0AC\uD560 \uC218 \uC5C6\uC5B4 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD588\uC2B5\uB2C8\uB2E4.";
map["The capture could not be checked"] = "\uCEA1\uCC98\uB97C \uAC80\uC0AC\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4";
map["Its sensitive data could not be covered, so it was discarded: it is never shown or saved unchecked."] = "\uBBFC\uAC10 \uC815\uBCF4\uB97C \uAC00\uB9AC\uC9C0 \uBABB\uD574 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD588\uC2B5\uB2C8\uB2E4. \uAC80\uC0AC\uD558\uC9C0 \uC54A\uC740 \uCEA1\uCC98\uB294 \uD45C\uC2DC\uD558\uAC70\uB098 \uC800\uC7A5\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.";
- map["Captures are discarded: no text recognition (OCR)"] = "\uD14D\uC2A4\uD2B8 \uC778\uC2DD(OCR)\uC774 \uC5C6\uC5B4 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4";
- map["Your organization requires \u201C{0}\u201D, but this Windows has no OCR installed, so every capture is discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or contact IT."] = "\uC870\uC9C1\uC5D0\uC11C \u2018{0}\u2019 \uC0AC\uC6A9\uC744 \uC694\uAD6C\uD558\uC9C0\uB9CC \uC774 Windows\uC5D0\uB294 OCR\uC774 \uC124\uCE58\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC544, \uAC80\uC0AC\uD558\uC9C0 \uC54A\uC740 \uCEA1\uCC98\uAC00 \uD45C\uC2DC\uB418\uC9C0 \uC54A\uB3C4\uB85D \uBAA8\uB4E0 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4. Windows \uC124\uC815 > \uC571 > \uC120\uD0DD\uC801 \uAE30\uB2A5\uC5D0\uC11C OCR \uC5B8\uC5B4\uB97C \uC124\uCE58\uD558\uAC70\uB098 IT \uBD80\uC11C\uC5D0 \uBB38\uC758\uD558\uC138\uC694.";
- map["With \u201C{0}\u201D on, every capture is checked before it is shown, and this Windows has no OCR installed, so captures are discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or turn the option off."] = "\u2018{0}\u2019 \uC635\uC158\uC774 \uCF1C\uC838 \uC788\uC73C\uBA74 \uBAA8\uB4E0 \uCEA1\uCC98\uB97C \uD45C\uC2DC\uD558\uAE30 \uC804\uC5D0 \uAC80\uC0AC\uD558\uB294\uB370, \uC774 Windows\uC5D0\uB294 OCR\uC774 \uC124\uCE58\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC544 \uAC80\uC0AC\uD558\uC9C0 \uC54A\uC740 \uCEA1\uCC98\uAC00 \uD45C\uC2DC\uB418\uC9C0 \uC54A\uB3C4\uB85D \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4. Windows \uC124\uC815 > \uC571 > \uC120\uD0DD\uC801 \uAE30\uB2A5\uC5D0\uC11C OCR \uC5B8\uC5B4\uB97C \uC124\uCE58\uD558\uAC70\uB098 \uC774 \uC635\uC158\uC744 \uB044\uC138\uC694.";
+ map["Captures discarded: no OCR"] = "OCR\uC774 \uC5C6\uC5B4 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4";
+ map["Your organization requires redaction, but this Windows has no OCR, so captures are discarded. Install an OCR language or contact IT."] = "\uC870\uC9C1\uC5D0\uC11C \uBBFC\uAC10 \uC815\uBCF4 \uAC00\uB9AC\uAE30\uB97C \uC694\uAD6C\uD558\uC9C0\uB9CC \uC774 Windows\uC5D0\uB294 OCR\uC774 \uC5C6\uC5B4 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4. OCR \uC5B8\uC5B4\uB97C \uC124\uCE58\uD558\uAC70\uB098 IT\uC5D0 \uBB38\uC758\uD558\uC138\uC694.";
+ map["No OCR on this Windows, so captures are discarded. Install an OCR language or turn off \u201C{0}\u201D."] = "\uC774 Windows\uC5D0\uB294 OCR\uC774 \uC5C6\uC5B4 \uCEA1\uCC98\uB97C \uC0AD\uC81C\uD569\uB2C8\uB2E4. OCR \uC5B8\uC5B4\uB97C \uC124\uCE58\uD558\uAC70\uB098 \u2018{0}\u2019 \uC635\uC158\uC744 \uB044\uC138\uC694.";
map["Pasted"] = "\uBD99\uC5EC\uB123\uC74C";
map["Okay, I won't."] = "\uC54C\uACA0\uC5B4, \uC548 \uD560\uAC8C.";
map["tomorrow "] = "\uB0B4\uC77C ";
diff --git a/src/I18n.Korean.HomeSettings.cs b/src/I18n.Korean.HomeSettings.cs
index 27836bc..52dcbc0 100644
--- a/src/I18n.Korean.HomeSettings.cs
+++ b/src/I18n.Korean.HomeSettings.cs
@@ -88,9 +88,7 @@ static void RegisterKoreanHomeSettings(Dictionary map)
map["Uninstall Stackshot\u2026"] = "Stackshot \uC81C\uAC70\u2026";
map["Updates"] = "\uC5C5\uB370\uC774\uD2B8";
map["You have version {0}. Stackshot updates are managed by your organization."] = "\uD604\uC7AC \uBC84\uC804\uC740 {0}\uC785\uB2C8\uB2E4. \uC870\uC9C1\uC5D0\uC11C Stackshot \uC5C5\uB370\uC774\uD2B8\uB97C \uAD00\uB9AC\uD569\uB2C8\uB2E4.";
- map["Downloading Stackshot {0}"] = "\uB2E4\uC6B4\uB85C\uB4DC \uC911 Stackshot {0}";
- map["Verifying Stackshot {0}"] = "\uAC80\uC99D \uC911 Stackshot {0}";
- map["Installing Stackshot {0}"] = "\uC124\uCE58 \uC911 Stackshot {0}";
+ map["Verifying Stackshot {0}"] = "Stackshot {0} \uAC80\uC99D \uC911";
map["Verifying SHA-256 checksum and signature before installing."] = "\uC124\uCE58\uD558\uAE30 \uC804\uC5D0 SHA-256 \uCCB4\uD06C\uC12C\uACFC \uC11C\uBA85\uC744 \uAC80\uC99D\uD569\uB2C8\uB2E4.";
map["As soon as recording is saved, Stackshot will restart."] = "\uB179\uD654\uB97C \uC800\uC7A5\uD558\uBA74 Stackshot\uC774 \uB2E4\uC2DC \uC2DC\uC791\uB429\uB2C8\uB2E4.";
map["Stackshot will restart in a few seconds."] = "\uC7A0\uC2DC \uD6C4 Stackshot\uC774 \uB2E4\uC2DC \uC2DC\uC791\uB429\uB2C8\uB2E4.";
@@ -334,7 +332,7 @@ static void RegisterKoreanHomeSettings(Dictionary map)
map["and {0} more"] = "\uC678 {0}\uAC1C";
map["Also: {0}"] = "\uCD94\uAC00: {0}";
map["Press the combination\u2026"] = "\uD0A4 \uC870\uD569\uC744 \uB204\uB974\uC138\uC694\u2026";
- map["Print Screen now belongs to Stackshot"] = "\uC774\uC81C Print Screen\uC73C\uB85C Stackshot\uC744 \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4";
+ map["Print Screen now belongs to Stackshot"] = "Print Screen\uC740 Stackshot \uC804\uC6A9";
map["Windows had reserved it for Snipping Tool; it is now freed for your user. If Snipping Tool still opens, sign out and back in."] = "Windows \uCEA1\uCC98 \uB3C4\uAD6C\uC5D0 \uD560\uB2F9\uB41C \uD0A4\uB97C \uC774 \uACC4\uC815\uC5D0\uC11C \uD574\uC81C\uD588\uC2B5\uB2C8\uB2E4. \uCEA1\uCC98 \uB3C4\uAD6C\uAC00 \uACC4\uC18D \uC5F4\uB9AC\uBA74 \uB85C\uADF8\uC544\uC6C3 \uD6C4 \uB2E4\uC2DC \uB85C\uADF8\uC778\uD558\uC138\uC694.";
map["Where your saved captures go."] = "\uCEA1\uCC98\uB97C \uC800\uC7A5\uD560 \uD3F4\uB354\uC785\uB2C8\uB2E4.";
map["Change\u2026"] = "\uBCC0\uACBD\u2026";
diff --git a/src/News.cs b/src/News.cs
index ac5086c..d7a21e4 100644
--- a/src/News.cs
+++ b/src/News.cs
@@ -19,6 +19,8 @@ public sealed class Item
}
public const string Start = "", End = "";
+ // The same news in English, which the release workflow writes beside the Spanish ones.
+ public const string StartEn = "", EndEn = "";
static string embedded, testEn, testDe, testKo;
static bool loaded;
@@ -119,13 +121,18 @@ static List- Section(string md, string version)
return Bullets(lines);
}
- // The news a release on GitHub carries for its version (empty if it has none, as releases before 2.2.0).
- public static List
- FromRelease(string body)
+ // The news a release on GitHub carries for its version, in Spanish (empty if it has none, as releases before 2.2.0).
+ public static List
- FromRelease(string body) { return Between(body, Start, End); }
+
+ // The same news in English (empty when the release only carries the Spanish ones).
+ public static List
- FromReleaseEnglish(string body) { return Between(body, StartEn, EndEn); }
+
+ static List
- Between(string body, string start, string end)
{
if (string.IsNullOrEmpty(body)) return new List
- ();
- int a = body.IndexOf(Start, StringComparison.Ordinal), b = a < 0 ? -1 : body.IndexOf(End, a, StringComparison.Ordinal);
+ int a = body.IndexOf(start, StringComparison.Ordinal), b = a < 0 ? -1 : body.IndexOf(end, a, StringComparison.Ordinal);
if (a < 0 || b < 0) return new List
- ();
- string part = body.Substring(a + Start.Length, b - a - Start.Length);
+ string part = body.Substring(a + start.Length, b - a - start.Length);
return Bullets(new List(part.Replace("\r", "").Split('\n')));
}
diff --git a/src/NewsWindow.cs b/src/NewsWindow.cs
index efcf184..8862af7 100644
--- a/src/NewsWindow.cs
+++ b/src/NewsWindow.cs
@@ -76,9 +76,8 @@ void Build()
if (r != null)
{
version = r.Version.ToString(3);
- items = new List(r.News);
- // A release without Spanish news (older ones): its own headlines, as they are.
- if (items.Count == 0) foreach (string n in r.Notes) items.Add(new News.Item { Title = n, Text = "" });
+ // The news in the interface language, or the release's own headlines as they are (older ones, other languages).
+ items = new List(r.Items());
}
else
{
diff --git a/src/ShotStack.Language.cs b/src/ShotStack.Language.cs
index 32e783d..4522ff6 100644
--- a/src/ShotStack.Language.cs
+++ b/src/ShotStack.Language.cs
@@ -17,6 +17,19 @@ internal static string OfferedLanguage(CultureInfo windows)
return I18n.GermanWindows(windows) ? "de" : windows.TwoLetterISOLanguageName == "ko" ? "ko" : "en";
}
+ // The words of the offer, in the language it offers. The settings route is named as the user sees it now (Spanish)
+ // and as it will read after the switch; the toast has three lines, so the sentence around it stays short.
+ internal static void OfferTexts(string target, out string title, out string body, out string button)
+ {
+ bool korean = target == "ko", german = target == "de";
+ title = korean ? "Stackshot\uC744 \uD55C\uAD6D\uC5B4\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC788\uC5B4\uC694" :
+ german ? "Stackshot gibt es jetzt auf Deutsch" : "Stackshot is now available in English";
+ body = korean ? "\uD55C\uAD6D\uC5B4\uB85C \uBC14\uAFC0\uAE4C\uC694? \uB098\uC911\uC5D0 Ajustes \u203A General \u203A Apariencia \u203A Idioma (\uC124\uC815 \u203A \uC77C\uBC18 \u203A \uD654\uBA74 \uBAA8\uC591 \u203A \uC5B8\uC5B4)\uC5D0\uC11C \uBC14\uAFC0 \uC218 \uC788\uC5B4\uC694." :
+ german ? "Auf Deutsch umstellen? \u00C4nderbar unter Ajustes \u203A General \u203A Apariencia \u203A Idioma (Einstellungen \u203A Allgemein \u203A Erscheinungsbild \u203A Sprache)." :
+ "Switch to English? You can change it later in Ajustes \u203A General \u203A Apariencia \u203A Idioma (Settings \u203A General \u203A Appearance \u203A Language).";
+ button = korean ? "\uD55C\uAD6D\uC5B4 \uC0AC\uC6A9" : german ? "Deutsch verwenden" : "Use English";
+ }
+
// Keep the current UI in Spanish until the user accepts the offer.
void OfferLanguage()
{
@@ -25,16 +38,9 @@ void OfferLanguage()
settings.LanguageOffered = true;
settings.Save();
string target = OfferedLanguage(windows);
- bool korean = target == "ko", german = target == "de";
- string language;
- try { language = new CultureInfo(windows.TwoLetterISOLanguageName).EnglishName; }
- catch (CultureNotFoundException) { language = "another language"; }
- string title = korean ? "Stackshot\uC744 \uD55C\uAD6D\uC5B4\uB85C \uC0AC\uC6A9\uD560 \uC218 \uC788\uC5B4\uC694" :
- german ? "Stackshot gibt es jetzt auf Deutsch" : "Stackshot is now available in English";
- string body = korean ? "Stackshot\uC744 \uD55C\uAD6D\uC5B4\uB85C \uBC14\uAFC0\uAE4C\uC694? \uB098\uC911\uC5D0 \uC124\uC815\uC758 \uC77C\uBC18 > \uD654\uBA74 \uBAA8\uC591 > \uC5B8\uC5B4\uC5D0\uC11C \uBCC0\uACBD\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4." :
- german ? "Dein Windows ist auf Deutsch. Stackshot auf Deutsch umstellen? Du kannst das jederzeit unter Ajustes \u203A General \u203A Apariencia \u203A Idioma (Einstellungen \u203A Allgemein \u203A Erscheinungsbild \u203A Sprache) \u00E4ndern." :
- "Your Windows is in " + language + ". Switch Stackshot to English? You can change it any time in Ajustes \u203A General \u203A Apariencia \u203A Idioma (Settings \u203A General \u203A Appearance \u203A Language).";
- Notify(title, body, NoticeKind.Info, korean ? "\uD55C\uAD6D\uC5B4 \uC0AC\uC6A9" : german ? "Deutsch verwenden" : "Use English", delegate
+ string title, body, button;
+ OfferTexts(target, out title, out body, out button);
+ Notify(title, body, NoticeKind.Info, button, delegate
{
LanguagePicker.Apply(settings, target);
Log("Idioma: " + target + ", aceptado desde el aviso");
diff --git a/src/ShotStack.Sensitive.cs b/src/ShotStack.Sensitive.cs
index dc1d775..67a8485 100644
--- a/src/ShotStack.Sensitive.cs
+++ b/src/ShotStack.Sensitive.cs
@@ -72,9 +72,12 @@ bool CoverBeforeShowing(Bitmap shot, string path, ref Bitmap preview, ref Bitmap
// The fail-closed notice when a capture cannot be covered at all.
void DiscardCaptureNotice()
{
- Notify(I18n.T("No se pudo revisar la captura", "The capture could not be checked", "Die Aufnahme konnte nicht gepr\u00FCft werden"),
- I18n.T("No se pudieron tapar sus datos sensibles, as\u00ED que se ha descartado: nunca se muestra ni se guarda sin revisar.", "Its sensitive data could not be covered, so it was discarded: it is never shown or saved unchecked.", "Ihre sensiblen Daten konnten nicht geschw\u00E4rzt werden, deshalb wurde sie verworfen: Sie wird nie ungepr\u00FCft gezeigt oder gespeichert."),
- NoticeKind.Error, null, null);
+ Notify(I18n.T("No se pudo revisar la captura", "The capture could not be checked", "Aufnahme nicht gepr\u00FCft"), DiscardBody(), NoticeKind.Error, null, null);
+ }
+
+ internal static string DiscardBody()
+ {
+ return I18n.T("No se pudieron tapar sus datos sensibles, as\u00ED que se ha descartado: nunca se muestra ni se guarda sin revisar.", "Its sensitive data could not be covered, so it was discarded: it is never shown or saved unchecked.", "Ihre sensiblen Daten konnten nicht geschw\u00E4rzt werden, deshalb wurde sie verworfen: Sie wird nie ungepr\u00FCft gezeigt oder gespeichert.");
}
static void Discard(CoverOutcome r)
@@ -95,20 +98,24 @@ void WarnOcrMissing()
// The switch is named by its own setting title, so the quoted words are the ones the user sees in whatever
// language (the German one comes from the same catalog key, never retyped here).
string title = PolicyTitles.Sensitive;
- // What a policy forces cannot be turned off: say who requires it instead of naming a way out the user has.
- Notify(I18n.T("Las capturas se descartan: no hay reconocimiento de texto (OCR)", "Captures are discarded: no text recognition (OCR)", "Aufnahmen werden verworfen: keine Texterkennung (OCR)"),
- I18n.IsKorean
- ? I18n.Fmt("", Policy.SensitiveForced
- ? "Your organization requires \u201C{0}\u201D, but this Windows has no OCR installed, so every capture is discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or contact IT."
- : "With \u201C{0}\u201D on, every capture is checked before it is shown, and this Windows has no OCR installed, so captures are discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or turn the option off.", title)
- : Policy.SensitiveForced
- ? I18n.T("Tu organizaci\u00F3n exige \u00AB" + title + "\u00BB, pero este Windows no tiene OCR instalado, as\u00ED que cada captura se descarta para que nada se muestre sin revisar. Instala un idioma de OCR (Configuraci\u00F3n de Windows > Aplicaciones > Caracter\u00EDsticas opcionales) o consulta con inform\u00E1tica.",
- "Your organization requires \u201C" + title + "\u201D, but this Windows has no OCR installed, so every capture is discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or contact IT.",
- "Deine Organisation verlangt \u201E" + title + "\u201C, aber dieses Windows hat keine OCR installiert, daher wird jede Aufnahme verworfen, statt ungepr\u00FCft gezeigt zu werden. Installiere eine OCR-Sprache (Windows-Einstellungen > Apps > Optionale Features) oder wende dich an die IT.")
- : I18n.T("Con \u00AB" + title + "\u00BB activado, cada captura se revisa antes de mostrarla y este Windows no tiene OCR instalado, as\u00ED que se descarta para que nada se muestre sin revisar. Instala un idioma de OCR (Configuraci\u00F3n de Windows > Aplicaciones > Caracter\u00EDsticas opcionales) o desactiva la opci\u00F3n.",
- "With \u201C" + title + "\u201D on, every capture is checked before it is shown, and this Windows has no OCR installed, so captures are discarded rather than shown unchecked. Install an OCR language (Windows Settings > Apps > Optional features) or turn the option off.",
- "Mit \u201E" + title + "\u201C aktiviert wird jede Aufnahme gepr\u00FCft, bevor sie gezeigt wird, und dieses Windows hat keine OCR installiert, daher werden Aufnahmen verworfen, statt ungepr\u00FCft gezeigt zu werden. Installiere eine OCR-Sprache (Windows-Einstellungen > Apps > Optionale Features) oder schalte die Option aus."),
- NoticeKind.Warning, null, null);
+ Notify(I18n.T("Capturas descartadas: falta el OCR", "Captures discarded: no OCR", "Aufnahmen verworfen: OCR fehlt"), OcrMissingBody(title, Policy.SensitiveForced), NoticeKind.Warning, null, null);
+ }
+
+ // What a policy forces cannot be turned off: say who requires it instead of naming a way out the user has.
+ internal static string OcrMissingBody(string title, bool forced)
+ {
+ // Three toast lines: the way to the OCR languages is in Windows' own settings, so the text stays short (the German
+ // name of the switch alone fills a line and a half, so German says what it does).
+ return I18n.IsKorean
+ ? forced ? I18n.Localize("Your organization requires redaction, but this Windows has no OCR, so captures are discarded. Install an OCR language or contact IT.")
+ : I18n.Fmt("", "No OCR on this Windows, so captures are discarded. Install an OCR language or turn off \u201C{0}\u201D.", title)
+ : forced
+ ? I18n.T("Tu organizaci\u00F3n exige tapar los datos sensibles y este Windows no tiene OCR: se descartan las capturas. Consulta con inform\u00E1tica.",
+ "Your organization requires redaction, but this Windows has no OCR, so captures are discarded. Install an OCR language or contact IT.",
+ "Deine Organisation verlangt Schw\u00E4rzung, aber dieses Windows hat keine OCR: Aufnahmen werden verworfen. Frag die IT.")
+ : I18n.T("Este Windows no tiene OCR y las capturas se descartan. Instala un idioma de OCR o desactiva \u00AB" + title + "\u00BB.",
+ "No OCR on this Windows, so captures are discarded. Install an OCR language or turn off \u201C" + title + "\u201D.",
+ "Ohne OCR werden Aufnahmen verworfen. Installiere eine OCR-Sprache oder schalte das automatische Schw\u00E4rzen aus.");
}
// The check is over: the card shows the capture as it is now with a note, and the copy goes to the clipboard
diff --git a/src/ToastWindow.cs b/src/ToastWindow.cs
index c0066b0..f59956e 100644
--- a/src/ToastWindow.cs
+++ b/src/ToastWindow.cs
@@ -259,6 +259,7 @@ public sealed class ToastLook
public double TextLeft, TitleTop, TextTop, LineHeight;
public int Lines; // lines of text shown
public bool Clipped; // the text did not fit in them
+ public bool TitleClipped; // the title is wider than its line and ends in an ellipsis
M.FormattedText title, text, label;
ToastLook(Notice n, float scale)
@@ -290,6 +291,8 @@ void Arrange()
title.MaxTextWidth = Math.Max(1, titleW);
title.MaxLineCount = 1;
title.Trimming = W.TextTrimming.CharacterEllipsis;
+ M.FormattedText whole = Ink.Px(Notice.Title, Ds.Semibold, F(13.5), pal.Label);
+ TitleClipped = whole.Width > titleW + 0.5;
// A title alone sits level with the icon.
TitleTop = Notice.Text.Length > 0 ? Math.Round(F(Inset) - F(1)) : Math.Round(Icon.Y + (Icon.Height - title.Height) / 2);
TextTop = Math.Round(TitleTop + title.Height + F(2));
diff --git a/src/UpdateNotice.cs b/src/UpdateNotice.cs
index 750b249..343c0ee 100644
--- a/src/UpdateNotice.cs
+++ b/src/UpdateNotice.cs
@@ -1,6 +1,7 @@
// Stackshot - New version notice: a small banner by the clock that offers the update and follows its progress.
// MIT License - https://github.com/rubenitx/stackshot
using System;
+using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using W = System.Windows;
@@ -107,14 +108,15 @@ string Body()
}
if (state == "error") return Updater.Problem ?? "";
// What it brings comes first (the button "Novedades" has the rest).
- string brings = release.News.Count > 0 ? I18n.Fmt("Novedades: {0}.\n", "What's new: {0}.\n", News.Headline(release.News, 2)) : "";
+ List items = release.Items();
+ string brings = items.Count > 0 ? I18n.Fmt("Novedades: {0}.\n", "What's new: {0}.\n", News.Headline(items, 2)) : "";
if (Updater.IsReady && Updater.CanInstall) return brings + I18n.T("Ya est\u00E1 descargada y verificada. Al instalarla, Stackshot se cerrar\u00E1 y volver\u00E1 a abrirse.", "Already downloaded and verified. Upon installing, Stackshot will close and reopen.");
if (Updater.CanInstall) return brings + I18n.T("\u00BFQuieres descargarla? Se comprueba su firma y se instala en unos segundos.", "Do you want to download it? Its signature will be verified and it installs in seconds.");
if (Installer.ManagedByMsi) return brings + I18n.T("En este equipo las actualizaciones las instala inform\u00E1tica. \u00BFQuieres ver la nueva versi\u00F3n?", "On this machine updates are managed by IT. Would you like to view the new version?");
return brings + I18n.T("\u00BFQuieres descargarla? Esta versi\u00F3n se descarga desde su p\u00E1gina de GitHub.", "Do you want to download it? This version is downloaded from its GitHub page.");
}
- bool HasNews { get { return release.News.Count > 0 || release.Notes.Count > 0; } }
+ bool HasNews { get { return release.Items().Count > 0; } }
M.FormattedText LinkText(bool over)
{
diff --git a/src/Updater.cs b/src/Updater.cs
index 21eaef3..be57316 100644
--- a/src/Updater.cs
+++ b/src/Updater.cs
@@ -56,6 +56,19 @@ public class Release
public string Tag, Page, ExeUrl, SigUrl, Sha256;
public List Notes = new List();
public List News = new List(); // in Spanish, when the release carries them
+ public List NewsEn = new List(); // the same in English, when the release carries them
+
+ // What a notice tells of this release in the interface language. The news between the markers are Spanish
+ // (and English when the workflow wrote them), so Spanish reads those and every other language the English
+ // ones, or the changelog lines the release always has in English: never the Spanish news.
+ public List Items()
+ {
+ if (I18n.IsSpanish && News.Count > 0) return News;
+ if (!I18n.IsSpanish && NewsEn.Count > 0) return NewsEn;
+ List items = new List();
+ foreach (string n in Notes) items.Add(new News.Item { Title = n, Text = "" });
+ return items;
+ }
}
public static Release Available; // newer than this build, or null
@@ -449,10 +462,11 @@ static Release Parse(string json)
// Release notes: the changelog bullets, without Markdown emphasis.
string body = Str(root, "body") ?? "";
r.News = global::Stackshot.News.FromRelease(body);
+ r.NewsEn = global::Stackshot.News.FromReleaseEnglish(body);
foreach (string raw in body.Replace("\r", "").Split('\n'))
{
string line = raw.Trim();
- if (line.StartsWith("###") || line.StartsWith("
]+>", "");
int dot = line.IndexOf(". ");
diff --git a/tests/app/AppTestsI18n.cs b/tests/app/AppTestsI18n.cs
index 85a901b..3b66c21 100644
--- a/tests/app/AppTestsI18n.cs
+++ b/tests/app/AppTestsI18n.cs
@@ -64,6 +64,18 @@ public static void Suite()
T("numbers-follow-the-language", NumberCulture);
T("changed-listeners-are-independent", ChangedListeners);
T("reader-seek-parses-any-language", ReaderSeek);
+ T("settings-rows-not-squeezed", AppTestsI18nAudit.SettingsRowsNotSqueezed);
+ T("every-list-text-has-german", AppTestsI18nAudit.EveryListTextHasGerman);
+ T("every-list-text-has-korean", AppTestsI18nAudit.EveryListTextHasKorean);
+ T("release-news-only-in-spanish", AppTestsI18nAudit.ReleaseNewsOnlyInSpanish);
+ T("korean-keys-not-registered-twice-differently", AppTestsI18nAudit.KoreanKeysNotRegisteredTwiceDifferently);
+ T("notice-titles-fit-their-line", AppTestsI18nAudit.NoticeTitlesFitTheirLine);
+ T("language-offer-fits-its-toast", AppTestsI18nAudit.LanguageOfferFitsItsToast);
+ T("korean-update-steps-same-order", AppTestsI18nAudit.KoreanUpdateStepsSameOrder);
+ T("german-discard-title-matches-its-body", AppTestsI18nAudit.GermanDiscardTitleMatchesItsBody);
+ T("sensitive-notice-bodies-fit", AppTestsI18nAudit.SensitiveNoticeBodiesFit);
+ T("old-release-bodies-still-read", AppTestsI18nAudit.OldReleaseBodiesStillRead);
+ T("workflow-writes-the-markers", AppTestsI18nAudit.WorkflowWritesTheMarkers);
}
finally
{
@@ -522,7 +534,7 @@ internal static List Strings(object root)
return acc;
}
- static void Walk(DependencyObject d, HashSet seen, Action visit)
+ internal static void Walk(DependencyObject d, HashSet seen, Action visit)
{
if (d == null || !seen.Add(d)) return;
UIElement u = d as UIElement;
diff --git a/tests/app/AppTestsI18nAudit.cs b/tests/app/AppTestsI18nAudit.cs
new file mode 100644
index 0000000..ab5acb7
--- /dev/null
+++ b/tests/app/AppTestsI18nAudit.cs
@@ -0,0 +1,348 @@
+// Suite "i18n", audit regressions: layout and text checks that every interface language has to pass.
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Stackshot.Tests
+{
+ static class AppTestsI18nAudit
+ {
+ static readonly string[] AllLanguages = { "es", "en", "de", "ko", "fr", "pt", "zh", "hi", "ar", "bn" };
+ static readonly string[] SettingsPages = { "keys", "general", "editor", "record", "mascotset" };
+
+ static void Check(bool ok, string what) { if (!ok) throw new InvalidOperationException(what); }
+
+ // A row whose control takes the width leaves the text a sliver: the title shrinks to a few pixels and the
+ // description wraps to one letter per line. Every Settings page, in every language, at the window's usual size.
+ public static void SettingsRowsNotSqueezed()
+ {
+ List squeezed = new List();
+ List cut = new List();
+ foreach (string lang in AllLanguages)
+ {
+ I18n.Apply(lang);
+ HomeWindow hw = AppTestsI18n.Make(1);
+ try
+ {
+ foreach (string page in SettingsPages)
+ {
+ AppTestsI18n.SetPage(hw, page);
+ AppTestsI18n.Layout(hw);
+ AppTestsI18n.Walk(hw.Content as DependencyObject, new HashSet(), delegate(DependencyObject d)
+ {
+ TextBlock t = d as TextBlock;
+ if (t == null || string.IsNullOrEmpty(t.Text) || t.ActualWidth <= 0) return;
+ // A title that ends in an ellipsis loses its end: its natural width is wider than the room it got.
+ // (A row named after the user's own folder or device, "Windows default: Speakers (Model)", runs as long as that name.)
+ bool theirs = t.Text.Contains(":\\") || Regex.IsMatch(t.Text, @": .+ \(.+\)$");
+ if (!theirs && t.TextTrimming != TextTrimming.None && t.TextWrapping == TextWrapping.NoWrap)
+ {
+ TextBlock whole = new TextBlock { Text = t.Text, FontFamily = t.FontFamily, FontSize = t.FontSize, FontWeight = t.FontWeight, FontStyle = t.FontStyle, FontStretch = t.FontStretch };
+ whole.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
+ if (whole.DesiredSize.Width > t.ActualWidth + 0.5)
+ cut.Add(lang + "/" + page + ": " + t.Text + " (" + (int)whole.DesiredSize.Width + " > " + (int)t.ActualWidth + ")");
+ }
+ double line = t.FontSize * 1.3;
+ if (t.ActualWidth < 40 && t.ActualHeight > 3.5 * line)
+ squeezed.Add(lang + "/" + page + ": " + System.Text.RegularExpressions.Regex.Replace(t.Text, "[^\\x20-\\x7e]", "?") + " (" + (int)t.ActualWidth + " x " + (int)t.ActualHeight + ")");
+ });
+ }
+ }
+ finally { hw.Shutdown(); }
+ }
+ foreach (string s in squeezed) Console.WriteLine(" squeezed: " + s);
+ Check(squeezed.Count == 0, squeezed.Count + " squeezed text blocks");
+ foreach (string c in cut) Console.WriteLine(" cut title: " + System.Text.RegularExpressions.Regex.Replace(c, "[^\\x20-\\x7e]", "?"));
+ Check(cut.Count == 0, cut.Count + " settings titles end in an ellipsis");
+ }
+
+ // Texts that are the same in every language: formats and product names.
+ static readonly string[] SameEverywhere = { "Markdown", "GIF", "PDF", "OK", "HTML", "XML", "OCR", "Stackshot" };
+
+ // Words German spells the same as English.
+ static readonly string[] GermanSameWords = { "Extras", "Video", "Standard", "Maximum", "Text", "Timer" };
+
+ // A list of English lines beside its Spanish partner (FooEn / FooEs) with no German partner (FooDe) is translated
+ // through the catalog, one entry at a time: an entry the catalog lacks reaches the screen in English.
+ static List ListLeaks(string lang)
+ {
+ List leaks = new List();
+ foreach (Type type in typeof(I18n).Assembly.GetTypes())
+ {
+ FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
+ foreach (FieldInfo en in fields)
+ {
+ if (en.FieldType != typeof(string[]) || !en.Name.EndsWith("En", StringComparison.Ordinal)) continue;
+ string stem = en.Name.Substring(0, en.Name.Length - 2);
+ FieldInfo es = fields.FirstOrDefault(f => f.Name == stem + "Es" && f.FieldType == typeof(string[]));
+ if (es == null || fields.Any(f => f.Name == stem + "De")) continue;
+ string[] enList = (string[])en.GetValue(null), esList = (string[])es.GetValue(null);
+ for (int i = 0; i < enList.Length; i++)
+ {
+ string english = enList[i];
+ if (string.IsNullOrWhiteSpace(english) || SameEverywhere.Contains(english) || (lang == "de" && GermanSameWords.Contains(english))) continue;
+ if (!english.Any(char.IsLetter)) continue;
+ string shown = I18n.T(i < esList.Length ? esList[i] : english, english);
+ if (shown == english) leaks.Add(type.Name + "." + en.Name + "[" + i + "] " + english);
+ }
+ }
+ }
+ return leaks;
+ }
+
+ static void ListsLeak(string lang)
+ {
+ I18n.Apply(lang);
+ List leaks = ListLeaks(lang);
+ foreach (string l in leaks) Console.WriteLine(" english in " + lang + ": " + l);
+ Check(leaks.Count == 0, leaks.Count + " list entries stay in English in " + lang);
+ }
+
+ public static void EveryListTextHasGerman() { ListsLeak("de"); }
+ public static void EveryListTextHasKorean() { ListsLeak("ko"); }
+
+ const string SpanishHeadline = "Titular s\u00F3lo en espa\u00F1ol";
+
+ static Updater.Release ParseRelease(string body)
+ {
+ string json = "{\"tag_name\":\"v9.9.9\",\"body\":" + new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(body) + "}";
+ return (Updater.Release)typeof(Updater).GetMethod("Parse", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { json });
+ }
+
+ static string NoticeBody(Updater.Release r)
+ {
+ UpdateNotice w = new UpdateNotice((ShotStack)FormatterServices.GetUninitializedObject(typeof(ShotStack)), r);
+ try { return (string)typeof(UpdateNotice).GetMethod("Body", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(w, null); }
+ finally { w.Dispose(); }
+ }
+
+ // The release workflow writes the Spanish news between markers; a notice in any other language must not show them.
+ public static void ReleaseNewsOnlyInSpanish()
+ {
+ string body = "- **Recording works again** after a restart.\n- **Smaller files** for videos.\n\n" +
+ "Novedades en espa\u00F1ol
\n\n" + News.Start + "\n- **" + SpanishHeadline + ".** Cuerpo.\n" + News.End + "\n\n \n";
+ Updater.Release r = ParseRelease(body);
+ foreach (string lang in new[] { "en", "de", "ko" })
+ {
+ I18n.Apply(lang);
+ string text = NoticeBody(r);
+ Check(text.IndexOf(SpanishHeadline, StringComparison.Ordinal) < 0, lang + ": the notice shows the Spanish news: " + text);
+ }
+ I18n.Apply("en");
+ Check(NoticeBody(r).Contains("Recording works again"), "English: the notice carries the English changelog line");
+ I18n.Apply("es");
+ Check(NoticeBody(r).Contains(SpanishHeadline), "Spanish: the notice carries the Spanish news");
+
+ // A release that also carries the English news (the workflow writes both): every other language reads those.
+ string both = body + "\nWhat's new in English
\n\n" + News.StartEn + "\n- **Headline in English.** Body.\n" + News.EndEn + "\n\n \n";
+ Updater.Release r2 = ParseRelease(both);
+ Check(r2.News.Count == 1 && r2.NewsEn.Count == 1, "both news blocks are read apart");
+ foreach (string lang in new[] { "en", "de", "ko" })
+ {
+ I18n.Apply(lang);
+ string text = NoticeBody(r2);
+ Check(text.IndexOf(SpanishHeadline, StringComparison.Ordinal) < 0, lang + ": Spanish news with English ones present: " + text);
+ Check(text.Contains("Headline in English"), lang + ": the English news are not shown: " + text);
+ }
+ I18n.Apply("es");
+ Check(NoticeBody(r2).Contains(SpanishHeadline) && !NoticeBody(r2).Contains("Headline in English"), "Spanish keeps the Spanish news");
+ }
+
+ // The Korean catalog is a dictionary filled by assignments: a key assigned twice keeps only the last value, so
+ // the first one is dead text that looks like it counts (and hides which wording the screen shows).
+ public static void KoreanKeysNotRegisteredTwiceDifferently()
+ {
+ Regex assign = new Regex(@"map\[""((?:[^""\\]|\\.)*)""\]\s*=\s*""((?:[^""\\]|\\.)*)""\s*;");
+ Dictionary> seen = new Dictionary>(StringComparer.Ordinal);
+ List twice = new List();
+ foreach (string path in Directory.GetFiles(Path.Combine(AppTestsI18nCoverage.RepoRoot(), "src"), "I18n.Korean*.cs"))
+ {
+ string[] lines = File.ReadAllLines(path);
+ for (int i = 0; i < lines.Length; i++)
+ {
+ Match m = assign.Match(lines[i]);
+ if (!m.Success) continue;
+ string key = Regex.Unescape(m.Groups[1].Value), value = Regex.Unescape(m.Groups[2].Value);
+ string at = Path.GetFileName(path) + ":" + (i + 1);
+ KeyValuePair first;
+ if (!seen.TryGetValue(key, out first)) seen[key] = new KeyValuePair(value, at);
+ else if (first.Key != value) twice.Add("'" + key + "' at " + at + " and " + first.Value);
+ }
+ }
+ foreach (string t in twice) Console.WriteLine(" registered twice: " + Regex.Replace(t, "[^\\x20-\\x7e]", "?"));
+ Check(twice.Count == 0, twice.Count + " Korean keys are registered twice with different values");
+ }
+
+ // A notice title has one line of the toast, 268 px at 100 % (and its share at every scale): a longer one ends in an ellipsis and loses its end.
+ public static void NoticeTitlesFitTheirLine()
+ {
+ List sites = AppTestsI18nCoverage.NoticeTitleSites();
+ Check(sites.Count > 40, "only " + sites.Count + " notice titles found: the scan lost them");
+ List cut = new List();
+ foreach (string lang in new[] { "es", "en", "de", "ko" })
+ {
+ I18n.Apply(lang);
+ foreach (AppTestsI18nCoverage.TitleSite s in sites)
+ {
+ string title = s.Fmt ? string.Format(CultureInfo.InvariantCulture, I18n.T(s.Es, s.En), new object[] { "Stackshot", "2", "3" }) :
+ s.De != null ? I18n.T(s.Es, s.En, s.De) : I18n.T(s.Es, s.En);
+ foreach (float scale in new[] { 1f, 1.25f, 1.5f, 2f })
+ if (ToastLook.For(new Notice(title, "", NoticeKind.Info), scale).TitleClipped)
+ cut.Add(lang + " " + s.Where + " at " + (int)(scale * 100) + " %: " + Regex.Replace(title, "[^\\x20-\\x7e]", "?"));
+ }
+ }
+ foreach (string c in cut) Console.WriteLine(" cut: " + c);
+ Check(cut.Count == 0, cut.Count + " notice titles are cut with an ellipsis");
+ }
+
+ // The one-time offer of a language is three lines at most at every scale, and it names both routes to the setting:
+ // the one the user sees now (Spanish) and the one that will read after the switch. One register in Korean.
+ public static void LanguageOfferFitsItsToast()
+ {
+ string[][] cases = { new[] { "en", "en-US" }, new[] { "en", "fr-FR" }, new[] { "en", "pt-BR" }, new[] { "en", "vi-VN" }, new[] { "de", "de-DE" }, new[] { "ko", "ko-KR" } };
+ const string now = "Ajustes \u203A General \u203A Apariencia \u203A Idioma";
+ Dictionary after = new Dictionary
+ {
+ { "en", "Settings \u203A General \u203A Appearance \u203A Language" },
+ { "de", "Einstellungen \u203A Allgemein \u203A Erscheinungsbild \u203A Sprache" },
+ { "ko", "\uC124\uC815 \u203A \uC77C\uBC18 \u203A \uD654\uBA74 \uBAA8\uC591 \u203A \uC5B8\uC5B4" }
+ };
+ Dictionary opening = new Dictionary
+ {
+ { "en", "Switch to English? You can change it later in " + now + " (" + after["en"] + ")." },
+ { "de", "Auf Deutsch umstellen? \u00C4nderbar unter " + now + " (" + after["de"] + ")." },
+ { "ko", "\uD55C\uAD6D\uC5B4\uB85C \uBC14\uAFC0\uAE4C\uC694? \uB098\uC911\uC5D0 " + now + " (" + after["ko"] + ")\uC5D0\uC11C \uBC14\uAFC0 \uC218 \uC788\uC5B4\uC694." }
+ };
+ List bad = new List();
+ foreach (string[] c in cases)
+ {
+ string title, body, button;
+ ShotStack.OfferTexts(c[0], out title, out body, out button);
+ foreach (float scale in new[] { 1f, 1.25f, 1.5f, 2f })
+ {
+ Notice n = new Notice(title, body, NoticeKind.Info);
+ n.ActionLabel = button;
+ n.Action = delegate { };
+ ToastLook look = ToastLook.For(n, scale);
+ if (look.Clipped || look.TitleClipped) bad.Add(c[1] + " -> " + c[0] + " at " + (int)(scale * 100) + " %: clipped (" + (look.TitleClipped ? "title" : "text") + ", " + look.Lines + " lines)");
+ }
+ if (body != opening[c[0]]) bad.Add(c[1] + " -> " + c[0] + ": the wording is '" + Regex.Replace(body, "[^\\x20-\\x7e]", "?") + "'");
+ if (c[0] == "ko" && body.Contains("\uC2B5\uB2C8\uB2E4")) bad.Add(c[1] + ": Korean mixes the formal register into the offer");
+ }
+ foreach (string b in bad) Console.WriteLine(" offer: " + b);
+ Check(bad.Count == 0, bad.Count + " language offers do not fit their notice or word their route wrongly");
+ }
+
+ // The three steps of an update read "Stackshot {0} ..." in every language, in the same order: Korean puts the
+ // verb last, so "Verifying" must not lead with it while the others lead with the name.
+ public static void KoreanUpdateStepsSameOrder()
+ {
+ I18n.Apply("ko");
+ string down = I18n.Fmt("Descargando Stackshot {0}", "Downloading Stackshot {0}", "9.9.9");
+ string verify = I18n.Fmt("Comprobando Stackshot {0}", "Verifying Stackshot {0}", "9.9.9");
+ string install = I18n.Fmt("Instalando Stackshot {0}", "Installing Stackshot {0}", "9.9.9");
+ foreach (string t in new[] { down, verify, install })
+ Check(t.StartsWith("Stackshot 9.9.9 ", StringComparison.Ordinal), "Korean update step does not start with the name: " + Regex.Replace(t, "[^\\x20-\\x7e]", "?"));
+ }
+
+ // The German title of the fail-closed notice has to fit its body, which speaks of "sie" (the capture): it says
+ // the capture was not checked, not that a check failed.
+ public static void GermanDiscardTitleMatchesItsBody()
+ {
+ AppTestsI18nCoverage.TitleSite site = AppTestsI18nCoverage.NoticeTitleSites().FirstOrDefault(s => s.Es == "No se pudo revisar la captura");
+ Check(site != null && site.De != null, "the capture-not-checked notice title was not found");
+ Check(site.De == "Aufnahme nicht gepr\u00FCft", "German title is '" + Regex.Replace(site.De, "[^\\x20-\\x7e]", "?") + "'");
+ }
+
+ // The sensitive-data notices are read in a toast of three lines at every scale: the body must not end in an ellipsis.
+ public static void SensitiveNoticeBodiesFit()
+ {
+ List cut = new List();
+ foreach (string lang in new[] { "es", "en", "de", "ko" })
+ {
+ I18n.Apply(lang);
+ string title = PolicyTitles.Sensitive;
+ Dictionary bodies = new Dictionary();
+ bodies["discard"] = ShotStack.DiscardBody();
+ bodies["no OCR"] = ShotStack.OcrMissingBody(title, false);
+ bodies["no OCR (policy)"] = ShotStack.OcrMissingBody(title, true);
+ foreach (KeyValuePair b in bodies)
+ foreach (float scale in new[] { 1f, 1.25f, 1.5f, 2f })
+ {
+ ToastLook look = ToastLook.For(new Notice("Titulo", b.Value, NoticeKind.Warning), scale);
+ if (look.Clipped) cut.Add(lang + " " + b.Key + " at " + (int)(scale * 100) + " %: " + look.Lines + " lines, " + b.Value.Length + " chars");
+ }
+ }
+ foreach (string c in cut) Console.WriteLine(" cut body: " + c);
+ Check(cut.Count == 0, cut.Count + " sensitive-data notice bodies are cut");
+ }
+
+ // Releases from before the English news were written by older workflows: only the Spanish markers, CRLF, no markers,
+ // a start marker without its end, an empty body. Spanish still reads the Spanish news; any other language never
+ // reads them; nothing throws and a notice never shows an empty "What's new".
+ public static void OldReleaseBodiesStillRead()
+ {
+ string bullets = "- **Fixed the preview.** Better.\n- **Smaller files** for videos.\n";
+ string esNews = News.Start + "\n- **" + SpanishHeadline + ".** Cuerpo.\n" + News.End;
+ Dictionary bodies = new Dictionary();
+ bodies["spanish markers only"] = bullets + "\nNovedades
\n\n" + esNews + "\n\n \n";
+ bodies["crlf"] = (bullets + "\nNovedades
\n\n" + esNews + "\n\n \n").Replace("\n", "\r\n");
+ bodies["no markers"] = bullets;
+ bodies["start without end"] = bullets + "\n" + News.Start + "\n- **" + SpanishHeadline + ".** Cuerpo.\n";
+ bodies["empty"] = "";
+ foreach (KeyValuePair b in bodies)
+ {
+ Updater.Release r = ParseRelease(b.Value);
+ bool hasEs = b.Key == "spanish markers only" || b.Key == "crlf";
+ Check((r.News.Count == 1) == hasEs, b.Key + ": Spanish news read = " + r.News.Count);
+ Check(r.NewsEn.Count == 0, b.Key + ": English news appeared from nowhere");
+ I18n.Apply("es");
+ List es = r.Items();
+ if (hasEs) Check(es.Count == 1 && es[0].Title.Contains(SpanishHeadline), b.Key + ": Spanish does not read the Spanish news");
+ else Check((es.Count > 0) == (b.Key != "empty"), b.Key + ": Spanish items = " + es.Count);
+ Check(NoticeBody(r) != null, b.Key + ": Spanish notice body");
+ foreach (string lang in new[] { "en", "de", "ko", "fr", "ar" })
+ {
+ I18n.Apply(lang);
+ List items = r.Items();
+ foreach (News.Item it in items)
+ Check(it.Title.IndexOf(SpanishHeadline, StringComparison.Ordinal) < 0 && it.Text.IndexOf("Cuerpo", StringComparison.Ordinal) < 0, b.Key + ": " + lang + " shows the Spanish news");
+ Check((items.Count > 0) == (b.Key != "empty"), b.Key + ": " + lang + " items = " + items.Count);
+ string text = NoticeBody(r);
+ Check(text.IndexOf(SpanishHeadline, StringComparison.Ordinal) < 0, b.Key + ": " + lang + " notice shows the Spanish news: " + text);
+ if (items.Count == 0) Check(text.IndexOf("What's new", StringComparison.Ordinal) < 0 && text.IndexOf("Novedades", StringComparison.Ordinal) < 0, b.Key + ": " + lang + " announces news it does not have: " + text);
+ }
+ }
+ I18n.Apply("es");
+ }
+
+ // The release workflow is what puts the news between the markers the app reads: it writes both the Spanish and
+ // the English ones, from the Spanish and English news files, and the newest section of each has bullets to write.
+ public static void WorkflowWritesTheMarkers()
+ {
+ string root = AppTestsI18nCoverage.RepoRoot();
+ string yml = File.ReadAllText(Path.Combine(root, ".github", "workflows", "build.yml"));
+ foreach (string marker in new[] { News.Start, News.End, News.StartEn, News.EndEn })
+ Check(yml.Contains("echo \"" + marker + "\""), "build.yml does not write " + marker);
+ Check(yml.Contains("docs/novedades.md") && yml.Contains("docs/novedades.en.md"), "build.yml does not read both news files");
+ Check(yml.IndexOf(News.Start, StringComparison.Ordinal) < yml.IndexOf(News.StartEn, StringComparison.Ordinal), "the Spanish block is written before the English one");
+ foreach (string file in new[] { "novedades.md", "novedades.en.md" })
+ {
+ string[] lines = File.ReadAllLines(Path.Combine(root, "docs", file));
+ int head = Array.FindIndex(lines, l => Regex.IsMatch(l, @"^## \d+\.\d+\.\d+\s*$"));
+ Check(head >= 0, file + " has no version section");
+ int bullets = 0;
+ for (int i = head + 1; i < lines.Length && !lines[i].StartsWith("## ", StringComparison.Ordinal); i++) if (lines[i].StartsWith("- ", StringComparison.Ordinal)) bullets++;
+ Check(bullets > 0, file + ": the newest version has no news for the workflow to write");
+ }
+ }
+ }
+}
diff --git a/tests/app/AppTestsI18nCoverage.cs b/tests/app/AppTestsI18nCoverage.cs
index f2d4003..060632f 100644
--- a/tests/app/AppTestsI18nCoverage.cs
+++ b/tests/app/AppTestsI18nCoverage.cs
@@ -25,7 +25,7 @@ sealed class Site { public string File; public int Line; public string En; }
{
// ShotStack.Language.cs: the offer of English is shown only to users whose interface is Spanish, on purpose
// in English, and it names the settings route in their language so they can find it.
- "ShotStack.Language.cs|. Switch Stackshot to English? You can change it any time in Ajustes \u203A General \u203A Apariencia \u203A Idioma (Settings \u203A General \u203A Appearance \u203A Language).|the English offer names the route in the user's current (Spanish) interface on purpose"
+ "ShotStack.Language.cs|Switch to English? You can change it later in Ajustes \u203A General \u203A Apariencia \u203A Idioma (Settings \u203A General \u203A Appearance \u203A Language).|the English offer names the route in the user's current (Spanish) interface on purpose"
};
const int Cap = 60;
@@ -568,7 +568,7 @@ public static void NoDuplicateGermanKeys()
sealed class Source { public string Rel; public string Text; }
// The repo root: the runner exports STACKSHOT_TESTS_ROOT; otherwise walk up from the test exe or the cwd.
- static string RepoRoot()
+ internal static string RepoRoot()
{
string env = Environment.GetEnvironmentVariable("STACKSHOT_TESTS_ROOT");
if (!string.IsNullOrEmpty(env) && File.Exists(Path.Combine(env, "src", "I18n.cs"))) return env;
@@ -722,6 +722,40 @@ static bool LiteralOf(List arg, out string value)
return true;
}
+ // One notice title as a call site writes it: the Spanish and English texts (and the German one when given), and the
+ // sample values a Fmt title takes.
+ internal sealed class TitleSite { public string Where, Es, En, De; public bool Fmt; public int Args; }
+
+ // Every notice raised with a title made by I18n.T or I18n.Fmt of literals: Notify, NotifyPage, PageNotice,
+ // FolderNotice and new Notice. Titles made any other way are not seen here.
+ internal static List NoticeTitleSites()
+ {
+ List found = new List();
+ string[] calls = { "Notify", "NotifyPage", "PageNotice", "FolderNotice", "Notice" };
+ foreach (Source f in Sources())
+ {
+ List toks = Tokenize(f.Text);
+ for (int i = 0; i < toks.Count - 1; i++)
+ {
+ if (toks[i].Com || toks[i].Str || Array.IndexOf(calls, toks[i].S) < 0 || toks[i + 1].S != "(") continue;
+ if (i > 0 && (toks[i - 1].S == "void" || toks[i - 1].S == "Notice") && toks[i].S != "Notice") continue;
+ int line = toks[i].Line, at = i + 1;
+ List> args = CallArgs(toks, ref at);
+ if (args.Count == 0) continue;
+ List a = args[0];
+ if (a.Count < 5 || a[0].S != "I18n" || a[1].S != "." || (a[2].S != "T" && a[2].S != "Fmt") || a[3].S != "(") continue;
+ int inner = 3;
+ List> parts = CallArgs(a, ref inner);
+ string es, en, de = null;
+ if (parts.Count < 2 || !LiteralOf(parts[0], out es) || !LiteralOf(parts[1], out en)) continue;
+ bool isFmt = a[2].S == "Fmt";
+ if (!isFmt && parts.Count == 3 && !LiteralOf(parts[2], out de)) continue;
+ found.Add(new TitleSite { Where = f.Rel + ":" + line, Es = es, En = en, De = de, Fmt = isFmt, Args = isFmt ? parts.Count - 2 : 0 });
+ }
+ }
+ return found;
+ }
+
static string Placeholders(string s)
{
SortedSet set = new SortedSet();