diff --git a/CHANGELOG.md b/CHANGELOG.md index eef7a61..fb6ec44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- **Korean interface.** Select 한국어 in the language picker or use Automatic on Korean Windows. Existing language preferences are preserved. + ## 2.2.1 - **Everything new since your version.** Right after an update, the news window lists what every version since the one you had brings, newest first under its number (from 2.1 straight to 2.2.1: both), and no longer stops at twenty items. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 35359d4..546f5e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ A screenshot tool for Windows in the spirit of CleanShot X: its own capture (scrolling capture too), a stack of floating thumbnails, a quick editor with a presentation backdrop, video and GIF through FFmpeg, a main window with a customizable mascot, and a per-user installation. A single `.exe` (about 2.2 MB) written in C# 5 + WinForms and WPF on .NET Framework 4.8. -Windows 10 and 11 only. The user interface is in Spanish and English (`src/I18n.cs`); code comments are in English. +Windows 10 and 11 only. The UI language registry is in `src/I18n.Languages.cs`; code comments are in English. ## Build and test @@ -70,12 +70,11 @@ Windows 10 and 11 only. The user interface is in Spanish and English (`src/I18n. ## Code rules - **C# 5 only**: no `$""`, `?.`, `nameof`, expression-bodied members, `out var` or auto-property initializers. -- **Every text in both languages.** What the user reads or hears goes through `I18n.T("español", "English")`, or - `I18n.Fmt(...)` when it carries values (same `{0}` placeholders in both); lists are `XxxEs`/`XxxEn` arrays behind a property - that picks one by `I18n.IsSpanish`, never a static field that calls `I18n.T` (it would freeze the language at startup). +- **Localize visible text.** What the user reads or hears goes through `I18n.T("español", "English")`, or + `I18n.Fmt(...)` when it carries values (same `{0}` placeholders in both); Korean translations in `src/I18n.Korean*.cs` use the exact English source string as their key, including whitespace and format placeholders. Missing keys display English. For lists, select the language at use time and pass the English array through `I18n.LocalizeList`. Keep shortcut bindings separate from labels. Never initialize a static label with `I18n.T`, which would freeze the language at startup. Logs, settings keys, file names on disk and anything compared to decide behaviour stay as they are: never decide by a translated text (use an id or a flag). A notice's kind comes from its title's first words (`Notice.KindFor`): give a new - title a start of the same kind in both languages. `tests\app\run-tests.ps1 i18n` checks that Automático follows Windows + title a start of the same kind in both languages. `tests\app\run-tests.ps1 i18n` checks that Automatic follows Windows and that no page shows Spanish in English. - **ASCII literals**: accented characters in strings are Unicode escapes. Some editing tools turn them into real characters; after editing, `perl tools/escape-literals.pl ` escapes them again. diff --git a/README.es.md b/README.es.md index 0feb890..4b1fcad 100644 --- a/README.es.md +++ b/README.es.md @@ -22,7 +22,7 @@ Para Windows 10 y 11 · Versión 2.1.0 · También como [paquete MSI](https://gi **Contenido:** [Tres pasos](#tres-pasos-ningún-menú) · [Novedades](#novedades-de-la-21) · [Funciones](#funciones-de-un-vistazo) · [Modos](#siete-formas-de-capturar) · [Capturar](#selecciona-captura-listo) · [Marcar](#márcala-en-segundos) · [Datos sensibles](#tápalo-antes-de-compartir) · [Desplazamiento](#captura-la-página-entera) · [Grabar](#graba-la-pantalla-con-sonido) · [Historial](#encuéntrala-por-lo-que-decía) · [XML y Markdown](#xml-y-markdown-a-otro-nivel) · [Ventana principal](#una-ventana-a-tu-manera) · [Pixel](#conoce-a-pixel-39-disfraces) · [Más](#y-mucho-más) · [Rendimiento](#ligera-rápida-privada) · [Instalación](#instalación) · [Línea de órdenes](#línea-de-órdenes-y-directivas-de-empresa) · [Atajos](#atajos-de-teclado) · [Privacidad](#privacidad-y-seguridad) · [Preguntas frecuentes](#preguntas-frecuentes) · [Compilar](#compilar-desde-el-código) · [Licencia](#licencia) > [!NOTE] -> La interfaz de Stackshot está en español y en inglés: sigue el idioma de Windows y se cambia en **Ajustes › General › Apariencia › Idioma**. Las capturas de esta página muestran la interfaz en español. +> En las compilaciones de esta rama, elige **한국어** en **Ajustes › General › Apariencia › Idioma**, o deja **Automático** para seguir el idioma de Windows. Las capturas de esta página muestran la interfaz en español. ## Tres pasos, ningún menú @@ -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í, y desde la 2.3.0 también en inglés. Una instalación nueva sigue el idioma de Windows (español en un Windows en español, catalán, gallego o euskera; inglés en los demás), y **Ajustes › General › Apariencia › Idioma** lo cambia al momento (Automático, Español, English). Quien ya usaba Stackshot sigue en español mientras no elija otro. La traducción al inglés la aportó [@altmashnaveed](https://github.com/altmashnaveed). +La versión de desarrollo ofrece español, inglés, alemán (parcial) y coreano, además de traducciones preliminares al francés, portugués, chino simplificado, hindi, árabe y bengalí. En modo automático, Windows en coreano usa coreano, Windows en español, catalán, gallego o euskera usa español, y Windows en alemán usa alemán. En los demás casos se usa inglés. Puedes elegir el idioma en **Ajustes › General › Apariencia › Idioma**, durante la instalación o desde la bandeja. La elección se aplica al momento y se conserva al reiniciar. Los perfiles anteriores sin idioma siguen en español hasta que elijas otro. Los textos que falten en coreano se muestran en inglés. La traducción al inglés la aportó [@altmashnaveed](https://github.com/altmashnaveed). ## Compilar desde el código diff --git a/README.md b/README.md index cab8a96..f6e2ad4 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ For Windows 10 and 11 · Version 2.1.0 · Also as an [MSI package](https://githu **Contents:** [Three steps](#three-steps-no-menus) · [What's new](#whats-new-in-21) · [Features](#features-at-a-glance) · [Modes](#seven-ways-to-capture) · [Capture](#select-snap-done) · [Mark up](#mark-it-up-in-seconds) · [Hide data](#hide-it-before-you-share-it) · [Scrolling](#capture-the-whole-page) · [Record](#record-your-screen-with-sound) · [History](#find-it-by-what-it-said) · [XML and Markdown](#xml-and-markdown-upgraded) · [Main window](#one-window-your-way) · [Pixel](#meet-pixel-39-costumes) · [More](#and-so-much-more) · [Performance](#small-fast-private) · [Installation](#installation) · [Command line](#command-line-and-it-policies) · [Shortcuts](#keyboard-shortcuts) · [Privacy](#privacy-and-security) · [FAQ](#faq) · [Build](#building-from-source) · [License](#license) > [!NOTE] -> The user interface is in English and Spanish: it follows your Windows language, and **Settings › General › Appearance › Language** changes it. Screenshots on this page show the Spanish interface. +> In builds from this branch, select **한국어** in **Settings › General › Appearance › Language**, or leave Language on **Auto** to follow the Windows display language. The screenshots below show the Spanish interface. ## Three steps, no menus @@ -649,7 +649,7 @@ Running `Stackshot.exe` offers to install it for your user (no administrator rig Is there an English interface?
-Yes. Since 2.3.0 Stackshot speaks English and Spanish. A new installation follows the Windows display language (Spanish on a Spanish, Catalan, Galician or Basque Windows; English everywhere else), and **Settings › General › Appearance › Language** switches it at once (Automatic, Español, English). Those who already used Stackshot keep Spanish until they choose otherwise. The English translation was contributed by [@altmashnaveed](https://github.com/altmashnaveed). +The development build offers Spanish, English, German (partial), and Korean, plus previews of French, Portuguese, Simplified Chinese, Hindi, Arabic and Bengali. A new installation on Korean Windows starts in Korean. Automatic mode also recognizes Spanish (including Catalan, Galician and Basque Windows) and German, with English elsewhere. Choose a language in **Settings › General › Appearance › Language**, at setup, or from the tray. Your choice takes effect immediately and is remembered. Existing profiles without a language keep Spanish until you choose another language. Missing Korean UI strings use English. The English translation was contributed by [@altmashnaveed](https://github.com/altmashnaveed). ## Building from source diff --git a/build.ps1 b/build.ps1 index 1ecf2f7..0355452 100644 --- a/build.ps1 +++ b/build.ps1 @@ -38,6 +38,8 @@ if (Test-Path $logo) { $cscArgs += "/resource:$logo,logo.png" } # What each version brings, shown inside the app (Novedades). $news = Join-Path $root 'docs\novedades.md' if (Test-Path $news) { $cscArgs += "/resource:$news,novedades.md" } +$koreanNews = Join-Path $root 'docs\novedades.ko.md' +if (Test-Path $koreanNews) { $cscArgs += "/resource:$koreanNews,novedades.ko.md" } # Build to a temp file and swap it in, so a failed build leaves the previous .exe intact. $output = & $csc @cscArgs $sources 2>&1 diff --git a/docs/novedades.ko.md b/docs/novedades.ko.md new file mode 100644 index 0000000..18e0f86 --- /dev/null +++ b/docs/novedades.ko.md @@ -0,0 +1,54 @@ +# Stackshot 변경 사항 + +## 2.2.2 + +- **한국어 인터페이스.** 이 개발 빌드에서는 설정 > 일반 > 화면 모양 > 언어에서 한국어를 선택할 수 있습니다. 자동 모드는 한국어 Windows를 인식하며, 직접 지정한 언어는 재시작 후에도 유지됩니다. + +## 2.2.1 + +- **배경 스타일 저장.** 편집기의 배경 패널에서 +를 누르면 현재 색상, 여백, 그림자, 안쪽 테두리와 정렬을 저장합니다. 저장한 스타일을 누르면 다시 적용됩니다. +- **배경 조절 속도 개선.** 큰 캡처에서도 여백, 안쪽 테두리, 그림자, 모서리 슬라이더의 변경 사항이 즉시 반영됩니다. +- **마스코트 절전.** 10분 넘게 자리를 비우면 마스코트 그리기를 멈추고, 돌아오면 다시 움직입니다. +- **스크롤 캡처 정확도 개선.** 부드럽게 스크롤할 때도 중간 줄이 빠지지 않습니다. +- **업데이트 내역 모아 보기.** 이전에 사용하던 버전 이후의 변경 사항을 버전별로 볼 수 있습니다. +- **오류 수정.** 쵸파와 케로가 각자의 대사를 합니다. Shift와 마우스 휠로 마지막 섹션까지 갈 수 있고, 페이지에 내용 없이 제목만 남는 문제를 고쳤습니다. + +## 2.2.0 + +- **편집기 배경 패널.** 배경 버튼을 누르면 그라데이션, 바탕 화면 배경, 내 이미지, 흐림, 단색을 선택할 수 있습니다. 여백, 안쪽 테두리와 자동 균형, 그림자, 모서리, 정렬과 화면 비율도 조절할 수 있습니다. +- **편집기에서 드래그.** 아래쪽 막대의 손잡이로 캡처를 채팅, 이메일 또는 다른 앱에 끌어 놓을 수 있습니다. +- **캡처 전 조정.** 선택한 영역을 미리 보면서 위치와 크기를 조정한 뒤 캡처할 수 있습니다. 기본값은 꺼짐입니다. +- **선명한 글자.** 창, 메뉴, 영역 선택 안내의 글자가 선명해졌습니다. 영역 선택 안내는 키마다 다른 색을 사용합니다. +- **XML 검색 결과 이동.** Enter, Shift+Enter, F3로 일치하는 항목을 하나씩 찾습니다. 원할 때만 필터를 적용하고, 큰 파일에서도 스크롤 막대를 사용할 수 있습니다. +- **멈춤 현상 개선.** 설정을 저장하거나 편집기를 닫거나 클립보드에 복사할 때 앱이 잠시 멈추는 현상을 줄였습니다. +- **썸네일 자동 숨기기.** 사용하지 않는 썸네일은 화면 가장자리로 접히고 남은 개수만 표시됩니다. 가장자리에 마우스를 올리면 하나씩 펼쳐집니다. 일반의 캡처 설정에서 바꿀 수 있습니다. +- **스포이트와 자.** 영역 선택 중 C를 누르면 픽셀을 확대해 색상을 복사할 수 있습니다. Shift를 누른 채 드래그하면 거리를 측정합니다. +- **타이머 캡처.** 영역을 선택한 뒤 3초, 5초 또는 10초 동안 메뉴나 알림을 열어 두면 지정한 시간에 캡처합니다. +- **캡처 합치기.** 한 썸네일을 다른 썸네일 위에 놓으면 이미지 한 장으로 합칩니다. +- **시간에 따라 달라지는 마스코트.** 아침에는 커피를 마시고, 밤에는 잠옷 모자를 쓰고, 금요일에는 파티를 합니다. 캡처할 때는 플래시가 터집니다. +- **새 캐릭터 5종.** 스티치, 커비, 그로구, 이브이, 파이리가 각자의 재주를 보여 줍니다. +- **새 포켓몬 6종.** 이상해씨, 꼬부기, 푸린, 잠만보, 팬텀, 뮤를 추가했습니다. 비모, 도라에몽, 토토로의 모습도 다듬었습니다. +- **새 캐릭터 24종.** 고라파덕, 토게피, 나옹, 팽도리, 따라큐, 루카리오, 망나뇽, 메타몽, 뮤츠와 지브리의 가오나시, 캘시퍼, 코다마가 합류했습니다. 요시, 팩맨, 크리퍼, 어몽 어스 크루원, 블링키, 슬라임, 스누피, 헬로키티, 베이비 그루트, 리락쿠마, 푸쉰, 포차코도 각자의 모습으로 등장합니다. +- **고전 게임 캐릭터.** 팩맨과 핑키·잉키·클라이드, 스페이스 인베이더, 굼바, 부끄부끄, 키노피오, 버섯과 1UP 버섯, 물음표 블록, 폭탄병, 멍멍이, 앵그리버드의 레드와 돼지를 추가했습니다. 할로우 나이트의 기사, 포탈의 동행 큐브, 봄버맨, 푸카, 폴가이, 마인크래프트 돼지, 메트로이드, 웨이들 디도 만날 수 있습니다. +- **캐릭터별 재주와 대사.** 팩맨이 점을 먹으면 유령이 파래지고, 마우스를 가까이하면 부끄부끄가 얼굴을 가립니다. 폭탄병과 크리퍼는 폭발하는 흉내를 내고, 멍멍이는 쇠사슬을 잡아당기고, 레드는 날아가고, 물음표 블록에서는 동전이 나옵니다. 캐릭터의 외곽선과 걷는 방향도 다듬었습니다. +- **커비와 크루원의 동작.** 커비의 둥근 몸과 볼, 팔, 빨간 발을 새로 그렸습니다. 크루원은 집으로 보낼 때 환풍구로 들어갑니다. +- **Klei 캐릭터.** Don't Starve Together의 윌슨과 윌로우, Oxygen Not Included의 복제체 두 명을 원작의 굵은 선과 음영으로 그렸습니다. 캐릭터 목록 끝에서 고를 수 있습니다. +- **녹화 저장 상태 표시.** 녹화를 중지하면 저장 중 카드가 나타나고, 저장을 마치면 그 자리에 동영상 썸네일이 표시됩니다. +- **드래곤 캐릭터.** 투슬리스, 라이트 퓨리, 스톰플라이, 훅팽, 미트러그가 플라스마, 위장, 가시, 불, 용암 등 각자의 능력을 보여 줍니다. +- **스크롤 캡처 안내.** 처음 사용할 때 방법을 알려 주고, 페이지가 내려가지 않으면 알림을 표시합니다. 몇 화면을 캡처했는지도 볼 수 있습니다. +- **바탕 화면 메모.** 메모를 색상 카드로 고정하고, 항상 위에 표시하거나 위치를 잠글 수 있습니다. 할 일은 클릭으로 완료하고, Enter로 목록을 이어 쓰며, 재시작 후에도 메모가 복원됩니다. +- **화면에 맞는 창.** 내 신고, 변경 사항, 알림 창이 커져도 화면 밖으로 잘리지 않습니다. 빈 곳을 드래그하면 창을 이동할 수 있습니다. +- **긴 Markdown 문서 PDF 저장.** 한 장의 이미지로 만들기에는 너무 긴 문서는 PDF로 저장할 수 있습니다. +- **사용하는 기능만 표시.** 물 마시기, 휴식, 걸음 수 중 활성화한 항목만 마스코트 메뉴와 하루 요약에 표시합니다. +- **앱에서 문제 신고와 아이디어 제안.** 홈의 정보 페이지에서 GitHub 계정 없이 의견을 보낼 수 있습니다. 내 신고에서 진행 상황과 답변을 확인하세요. +- **마스코트와 건강한 휴식.** 물 마시기, 눈 휴식, 스트레칭, 호흡 운동 시간을 알려 줍니다. 마스코트 설정에서 조절할 수 있고, 알림에 응답하면 처리 결과를 알려 줍니다. +- **메모와 바로가기 도우미.** 마스코트 메뉴에서 알림을 예약하거나 Notas.md에 메모를 남기세요. PC가 꺼져 있을 때 놓친 알림은 다음 사용 시 표시됩니다. 이미지, 동영상, XML, Markdown, 텍스트도 끌어 놓을 수 있습니다. 감시 중인 폴더에 오류 응답 XML이 도착하면 알려 줍니다. +- **워치 연동과 목표.** 물 한 잔을 기록하고, 하루 요약과 활동에 맞춘 휴식을 설정할 수 있습니다. Google Health를 통해 Pixel Watch 또는 Fitbit을 연결할 수 있습니다. +- **마스코트 집중 모드.** 집중 시간과 휴식을 번갈아 진행합니다. 마스코트가 옆에서 책을 읽고 남은 시간을 표시합니다. 건강 알림은 쉬는 시간까지 기다리고, 자리를 비우면 타이머가 멈춥니다. +- **성능 개선.** 큰 XML 파일이 더 빨리 열리고, 썸네일, 트레이 패널, 편집기, 동영상 플레이어가 더 적은 자원으로 부드럽게 동작합니다. +- **작업 결과 안내.** 복사, 저장, 정리, 목차 삽입을 마치면 버튼 또는 알림으로 확인할 수 있습니다. 실패하면 이유를 알려 줍니다. +- **문서 바로 열기.** .md 또는 .xml 파일을 열면 중간 화면을 거치지 않고 문서를 표시합니다. +- **붙여넣기 후 썸네일 닫기.** 브라우저와 Teams처럼 붙여넣기가 빠른 앱에서도 캡처 직후 붙여넣은 썸네일이 정상적으로 사라집니다. +- **케로와 카미나.** 마스코트의 캐릭터 목록에서 선택하고, 다른 캐릭터의 장식과 조합할 수 있습니다. +- **앱에서 변경 사항 확인.** 새 버전이 나오거나 업데이트를 마치면 앱에서 달라진 점을 확인할 수 있습니다. +- **오류 수정.** 여러 썸네일 위로 마우스를 움직인 후 버튼이 계속 표시되던 문제를 고쳤습니다. 스크롤 캡처가 도중에 실패하면 그때까지의 내용을 저장합니다. 썸네일의 둥근 T 버튼으로 이미지에서 텍스트를 복사할 수 있습니다. diff --git a/docs/novedades.md b/docs/novedades.md index 5d69734..5bb44f3 100644 --- a/docs/novedades.md +++ b/docs/novedades.md @@ -5,6 +5,10 @@ al actualizar y en Inicio > Acerca de > Novedades) y también se publica en la p Formato: una sección `## X.Y.Z` por versión y, en ella, una línea por novedad: `- **Título.** Explicación breve.` +## 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. + ## 2.2.1 - **Estilos guardados.** En el panel de fondos del editor, con + guardas el fondo que tienes (color, margen, sombra, inserción, alineación…) y desde «Estilos guardados» lo recuperas con un clic. diff --git a/docs/screens/language-ko.png b/docs/screens/language-ko.png new file mode 100644 index 0000000..234e212 Binary files /dev/null and b/docs/screens/language-ko.png differ diff --git a/docs/screens/settings-ko.png b/docs/screens/settings-ko.png new file mode 100644 index 0000000..34eeb1c Binary files /dev/null and b/docs/screens/settings-ko.png differ diff --git a/src/Capture/Cine.cs b/src/Capture/Cine.cs index 5266972..86039b9 100644 --- a/src/Capture/Cine.cs +++ b/src/Capture/Cine.cs @@ -43,9 +43,9 @@ public static class Cine public static string TrackName(string title) { if (I18n.IsSpanish || title == null) return title; - if (title == TitleMix) return "Mix (computer + microphone)"; - if (title == TitleSystem) return "Computer sound (original)"; - if (title == TitleMic) return "Microphone (original)"; + if (title == TitleMix) return I18n.Localize("Mix (computer + microphone)"); + if (title == TitleSystem) return I18n.Localize("Computer sound (original)"); + if (title == TitleMic) return I18n.Localize("Microphone (original)"); return title; } @@ -833,7 +833,8 @@ static void Probe(string ffmpeg, string master, CineExpect expect, CineVerificat foreach (string a in audios) if (!a.StartsWith("pcm_f32le", StringComparison.Ordinal) || !a.Contains("48000 Hz") || !a.Contains("stereo")) audioOk = false; if (expect.Audio.Count > 0 || audios.Count > 0) Add(v, I18n.T("Pistas de sonido", "Sound tracks"), audioOk, - audioOk ? (I18n.IsSpanish ? audios.Count + (audios.Count == 1 ? " pista" : " pistas") + " PCM de 32 bits, 48 kHz, est\u00E9reo." + audioOk ? (I18n.IsKorean ? I18n.Fmt("", "{0} tracks of 32-bit PCM, 48 kHz, stereo.", audios.Count) + : I18n.IsSpanish ? audios.Count + (audios.Count == 1 ? " pista" : " pistas") + " PCM de 32 bits, 48 kHz, est\u00E9reo." : audios.Count + (audios.Count == 1 ? " track" : " tracks") + " of 32-bit PCM, 48 kHz, stereo.") : I18n.Fmt("Se esperaban {0} pistas PCM de 32 bits a 48 kHz est\u00E9reo y hay {1} (o con otro formato).", "Expected {0} tracks of 32-bit PCM at 48 kHz stereo and there are {1} (or in another format).", expect.Audio.Count, audios.Count)); @@ -1136,28 +1137,28 @@ string SummaryEn() { StringBuilder sb = new StringBuilder(); double fps = FpsDen > 0 ? FpsNum / (double)FpsDen : 0; - sb.AppendLine("Cinema: " + Width + " \u00D7 " + Height + " at " + N(fps, "0.##") + " fps, " + N(RecordSeconds, "0.0") + " s, " + FramesWritten + " frames."); - if (!string.IsNullOrEmpty(File)) sb.AppendLine("File: " + System.IO.Path.GetFileName(File) + (FileBytes > 0 ? " (" + N(FileBytes / 1048576.0, "0.0") + " MB)" : "")); - if (StopReason != null) sb.AppendLine("The recording stopped early: " + StopReason + ". What was recorded up to then has been saved."); - if (Pauses > 0) sb.AppendLine("- Paused " + (Pauses == 1 ? "once" : Pauses + " times") + ": what happened during " + (Pauses == 1 ? "the pause" : "the pauses") + " is not in the file."); - if (OverlayFrames > 0) sb.AppendLine("- " + (OverlayFrames == 1 ? "1 frame has" : OverlayFrames + " frames have") + " clicks or pressed keys drawn on them (Recording > Clicks and keys)."); - if (HistoryMisses > 0) sb.AppendLine("- " + HistoryMisses + " frames may have taken the wrong screen image (the computer was too slow)."); - if (FramesRepeatedFailed > 0) sb.AppendLine("- " + FramesRepeatedFailed + " frames repeat the one before because the screen could not be read."); - if (FramesBlack > 0) sb.AppendLine("- " + FramesBlack + " black frames at the start because the screen could not be read."); - if (Discarded > 0) sb.AppendLine("- " + Discarded + " captured frames were never written."); - if (LostEvents > 0) sb.AppendLine("- Screen capture was interrupted " + LostEvents + (LostEvents == 1 ? " time" : " times") + " (" + N(LostMs, "0") + " ms with no new image)."); - if (Protected > 0) sb.AppendLine("- In " + Protected + " images Windows hid protected windows or windows excluded from capture on that screen (Stackshot's too); any inside the area is missing or black."); - if (Gdi) sb.AppendLine("- The fallback capture (GDI) was used: it does not see hardware-accelerated content."); - if (Hdr) sb.AppendLine("- The screen is in HDR: Windows hands over the image converted to SDR."); - if (RefreshHz > 0 && fps > 0 && RefreshHz > fps * 1.02) sb.AppendLine("- The monitor runs at " + N(RefreshHz, "0.#") + " Hz and recording is at " + N(fps, "0.##") + " fps: " + ImagesUnused + " screen images are not in any frame."); + sb.AppendLine(I18n.Fmt("", "Cinema: {0} \u00D7 {1} at {2} fps, {3} s, {4} frames.", Width, Height, N(fps, "0.##"), N(RecordSeconds, "0.0"), FramesWritten)); + if (!string.IsNullOrEmpty(File)) sb.AppendLine(I18n.Localize("File: ") + System.IO.Path.GetFileName(File) + (FileBytes > 0 ? " (" + N(FileBytes / 1048576.0, "0.0") + " MB)" : "")); + if (StopReason != null) sb.AppendLine(I18n.Fmt("", "The recording stopped early: {0}. What was recorded up to then has been saved.", StopReason)); + if (Pauses > 0) sb.AppendLine(Pauses == 1 ? I18n.Localize("- Paused once: what happened during the pause is not in the file.") : I18n.Fmt("", "- Paused {0} times: what happened during the pauses is not in the file.", Pauses)); + if (OverlayFrames > 0) sb.AppendLine(OverlayFrames == 1 ? I18n.Localize("- 1 frame has clicks or pressed keys drawn on them (Recording > Clicks and keys).") : I18n.Fmt("", "- {0} frames have clicks or pressed keys drawn on them (Recording > Clicks and keys).", OverlayFrames)); + if (HistoryMisses > 0) sb.AppendLine(I18n.Fmt("", "- {0} frames may have taken the wrong screen image (the computer was too slow).", HistoryMisses)); + if (FramesRepeatedFailed > 0) sb.AppendLine(I18n.Fmt("", "- {0} frames repeat the one before because the screen could not be read.", FramesRepeatedFailed)); + if (FramesBlack > 0) sb.AppendLine(I18n.Fmt("", "- {0} black frames at the start because the screen could not be read.", FramesBlack)); + if (Discarded > 0) sb.AppendLine(I18n.Fmt("", "- {0} captured frames were never written.", Discarded)); + if (LostEvents > 0) sb.AppendLine(I18n.Fmt("", LostEvents == 1 ? "- Screen capture was interrupted {0} time ({1} ms with no new image)." : "- Screen capture was interrupted {0} times ({1} ms with no new image).", LostEvents, N(LostMs, "0"))); + if (Protected > 0) sb.AppendLine(I18n.Fmt("", "- In {0} images Windows hid protected windows or windows excluded from capture on that screen (Stackshot's too); any inside the area is missing or black.", Protected)); + if (Gdi) sb.AppendLine(I18n.Localize("- The fallback capture (GDI) was used: it does not see hardware-accelerated content.")); + if (Hdr) sb.AppendLine(I18n.Localize("- The screen is in HDR: Windows hands over the image converted to SDR.")); + if (RefreshHz > 0 && fps > 0 && RefreshHz > fps * 1.02) sb.AppendLine(I18n.Fmt("", "- The monitor runs at {0} Hz and recording is at {1} fps: {2} screen images are not in any frame.", N(RefreshHz, "0.#"), N(fps, "0.##"), ImagesUnused)); if (AudioNotes != null) foreach (string a in AudioNotes) sb.AppendLine("- " + a); - if (!string.IsNullOrEmpty(Error)) sb.AppendLine("The master was not created: " + Error.Replace("\r", "").Replace("\n\n", " ").Replace("\n", " ")); - if (!string.IsNullOrEmpty(Rescued)) sb.AppendLine("What was recorded is in: " + Rescued); - if (Verification == null) sb.AppendLine("Check: not done."); - else if (Verification.Passed) sb.AppendLine("Check: passed, " + Verification.FramesMatched + " frames identical to the ones sent to the encoder."); + if (!string.IsNullOrEmpty(Error)) sb.AppendLine(I18n.Localize("The master was not created: ") + Error.Replace("\r", "").Replace("\n\n", " ").Replace("\n", " ")); + if (!string.IsNullOrEmpty(Rescued)) sb.AppendLine(I18n.Localize("What was recorded is in: ") + Rescued); + if (Verification == null) sb.AppendLine(I18n.Localize("Check: not done.")); + else if (Verification.Passed) sb.AppendLine(I18n.Fmt("", "Check: passed, {0} frames identical to the ones sent to the encoder.", Verification.FramesMatched)); else { - sb.AppendLine("Check: FAILED."); + sb.AppendLine(I18n.Localize("Check: FAILED.")); foreach (CineCheck c in Verification.Checks) if (!c.Passed) sb.AppendLine("- " + c.Name + ": " + c.Detail); } return sb.ToString().TrimEnd(); diff --git a/src/Capture/Ocr.cs b/src/Capture/Ocr.cs index 9ffe399..68be654 100644 --- a/src/Capture/Ocr.cs +++ b/src/Capture/Ocr.cs @@ -557,6 +557,7 @@ public static string Describe(string text) int cut = char.IsHighSurrogate(flat[87]) ? 87 : 88; flat = flat.Substring(0, cut).TrimEnd() + "\u2026"; } + if (I18n.IsKorean) return I18n.Fmt("", "{0} lines: \u201C{1}\u201D", n, flat); if (I18n.IsGerman) return n + (n == 1 ? " Zeile: „" : " Zeilen: „") + flat + "“"; string count = I18n.IsSpanish ? (n == 1 ? "1 l\u00EDnea" : n + " l\u00EDneas") : (n == 1 ? "1 line" : n + " lines"); return I18n.IsSpanish ? count + ": \u00AB" + flat + "\u00BB" : count + ": \u201C" + flat + "\u201D"; diff --git a/src/Capture/PinWindow.cs b/src/Capture/PinWindow.cs index 0f85aca..3e904dd 100644 --- a/src/Capture/PinWindow.cs +++ b/src/Capture/PinWindow.cs @@ -65,7 +65,6 @@ public static void Open(Bitmap image) int bx = Math.Max(wa.Left, Math.Min(wa.Right - body.Width, m.X - body.Width / 2)); int by = Math.Max(wa.Top, Math.Min(wa.Bottom - body.Height, m.Y - body.Height / 2)); Bounds = new Rectangle(bx - Pad, by - Pad, body.Width + 2 * Pad, body.Height + 2 * Pad); - ContextMenuStrip = BuildMenu(); restyle = delegate { if (IsHandleCreated && !IsDisposed) BeginInvoke((Action)Redraw); }; Ds.Changed += restyle; } @@ -85,9 +84,25 @@ protected override CreateParams CreateParams protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); + I18n.Changed += RefreshMenu; + RefreshMenu(); Redraw(); } + protected override void OnHandleDestroyed(EventArgs e) + { + I18n.Changed -= RefreshMenu; + base.OnHandleDestroyed(e); + } + + void RefreshMenu() + { + if (InvokeRequired) { BeginInvoke((Action)RefreshMenu); return; } + ContextMenuStrip previous = ContextMenuStrip; + ContextMenuStrip = BuildMenu(); + if (previous != null) previous.Dispose(); + } + protected override void OnPaintBackground(PaintEventArgs e) { } protected override void OnPaint(PaintEventArgs e) { } diff --git a/src/Capture/RecordBar.cs b/src/Capture/RecordBar.cs index 91ff1c0..b86a208 100644 --- a/src/Capture/RecordBar.cs +++ b/src/Capture/RecordBar.cs @@ -852,7 +852,7 @@ public override string Value protected override string Signature() { - return b.phase + "|" + b.paused + "|" + (b.armedAt >= 0) + "|" + b.CapLeft() + "|" + b.stopX + "|" + b.pauseX + "|" + b.discardX + "|" + b.srcX + + return I18n.Language + "|" + b.phase + "|" + b.paused + "|" + (b.armedAt >= 0) + "|" + b.CapLeft() + "|" + b.stopX + "|" + b.pauseX + "|" + b.discardX + "|" + b.srcX + "|" + (b.hasMic && b.session.Microphone.Muted) + "|" + (b.hasSys && b.session.SystemAudio.Muted); } diff --git a/src/Capture/RecordSetup.cs b/src/Capture/RecordSetup.cs index 2d92505..b8e1a30 100644 --- a/src/Capture/RecordSetup.cs +++ b/src/Capture/RecordSetup.cs @@ -47,7 +47,7 @@ public sealed class RecordSetup : Sheet "Verlustfreie Aufnahme und MP4 mit sehr hoher Qualität. Das Speichern dauert einen Moment.", "Verlustfreie, bildweise geprüfte Masterdatei (.mkv) mit hohem Speicherbedarf." }; - static string[] QualityNotes { get { return I18n.IsSpanish ? QualityNotesEs : I18n.IsGerman ? QualityNotesDe : QualityNotesEn; } } + static string[] QualityNotes { get { return I18n.IsSpanish ? QualityNotesEs : I18n.IsGerman ? QualityNotesDe : I18n.LocalizeList(QualityNotesEn); } } // Maxima is not lossless on areas above 1920x1200 at 60 fps: they go through NV12 (4:2:0) on the graphics card. internal static string QualityNote(int quality, D.Rectangle area) diff --git a/src/Capture/Recorder.cs b/src/Capture/Recorder.cs index 0dcb194..70dea6f 100644 --- a/src/Capture/Recorder.cs +++ b/src/Capture/Recorder.cs @@ -131,7 +131,7 @@ public static void Stop() static readonly string[] QualityNamesEs = { "Est\u00E1ndar", "M\u00E1xima", "Alta", "Cine" }; static readonly string[] QualityNamesEn = { "Standard", "Maximum", "High", "Cinema" }; static readonly string[] QualityNamesDe = { "Standard", "Maximum", "Hoch", "Kino" }; - internal static string[] QualityNames { get { return I18n.IsSpanish ? QualityNamesEs : I18n.IsGerman ? QualityNamesDe : QualityNamesEn; } } + internal static string[] QualityNames { get { return I18n.IsSpanish ? QualityNamesEs : I18n.IsGerman ? QualityNamesDe : I18n.LocalizeList(QualityNamesEn); } } // The frame rate a take will record at, as Session picks it. internal static int TargetFps(Settings s, bool gif, int cineFps) @@ -664,21 +664,21 @@ public static int Level(double minutes, int shown) public static string Chip(double minutes) { - return "~" + Math.Max(0, (int)Math.Floor(minutes)) + (I18n.IsSpanish ? " min de disco" : " min disk space"); + return I18n.Fmt("~{0} min de disco", "~{0} min disk space", Math.Max(0, (int)Math.Floor(minutes))); } public static string Range(double fromMin, double toMin) { if (toMin < 1) return I18n.T("menos de 1 min", "under 1 min"); - if (fromMin < 1) return (I18n.IsSpanish ? "hasta " : "up to ") + Minutes(toMin); + if (fromMin < 1) return I18n.Fmt("hasta {0}", "up to {0}", Minutes(toMin)); string a = Minutes(fromMin), b = Minutes(toMin); - return a == b ? (I18n.IsSpanish ? "unos " + a : "about " + a) : (I18n.IsSpanish ? "entre " + a + " y " + b : "between " + a + " and " + b); + return a == b ? I18n.Fmt("unos {0}", "about {0}", a) : I18n.Fmt("entre {0} y {1}", "between {0} and {1}", a, b); } static string Minutes(double m) { if (double.IsInfinity(m) || m > 99 * 60) return I18n.T("muchas horas", "many hours"); - return m < 120 ? (int)Math.Floor(m) + " min" : (int)Math.Floor(m / 60) + " h"; + return m < 120 ? I18n.Fmt("{0} min", "{0} min", (int)Math.Floor(m)) : I18n.Fmt("{0} h", "{0} h", (int)Math.Floor(m / 60)); } public static string Gb(long bytes) @@ -715,6 +715,13 @@ public static RecordHealth Assess(long frames, double seconds, long late, long m if ((long)w * h > 1920L * 1080) r.Advice.Add(I18n.T("grabar un \u00E1rea m\u00E1s peque\u00F1a", "record a smaller area")); if (!gif && (quality == Recorder.Maximum || quality == Recorder.Cinema)) r.Advice.Add(I18n.T("usar la calidad Alta", "use High quality")); r.Advice.Add(I18n.T("cerrar las apps que no uses", "close unused apps")); + if (I18n.IsKorean) + { + string detail = many ? I18n.Fmt("", "{0} frames ({1}%) were late or repeated.", r.Affected, Num(r.Percent)) + : I18n.Fmt("", "The computer paused for {0} s; frames may have repeated.", Num(maxLateMs / 1000)); + r.Text = I18n.Fmt("", "{0} Try: {1}.", detail, Join(r.Advice, 3)); + return r; + } string what = many ? (I18n.IsSpanish ? "Tu equipo no ha podido seguir el ritmo: " + r.Affected + " fotogramas (" + Num(r.Percent) + " %) salieron tarde o repetidos." @@ -738,7 +745,7 @@ static string Join(List items, int max) StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { - if (i > 0) sb.Append(i == n - 1 ? (I18n.IsSpanish ? " o " : " or ") : ", "); + if (i > 0) sb.Append(i == n - 1 ? I18n.T(" o ", " or ") : ", "); sb.Append(items[i]); } return sb.ToString(); @@ -876,6 +883,7 @@ internal static bool CancelPendingWrites(Thread t, uint threadId, int ms) string warning; bool fineTimer; // the 1 ms timer resolution is raised for this recording string error; + bool errorIsCancellation; RecordBar bar; WebcamBubble webcam; FrameEdge[] edges; @@ -2052,7 +2060,7 @@ internal void SaveFinal(double seconds) bool go = error == null && !cancelled && !saveCancelled; if (go && gif) MakeGif(seconds); else if (go && !direct) MakeVideo(seconds); - if (saveCancelled && !cancelled && error == null) error = PassWatch.CancelledText; + if (saveCancelled && !cancelled && error == null) SetCancellationError(); if (!cancelled && error != null && frames > 0) RescueOnError(); if (cancelled || error != null) DeleteOutput(); if (video != output) TryDelete(video); @@ -2085,7 +2093,7 @@ void CompleteCine() { report = BuildReport(); if (error == null && frames == 0) error = I18n.T("No se ha grabado ning\u00FAn fotograma.", "No frames were recorded."); - if (error == null && saveCancelled) error = PassWatch.CancelledText; + if (error == null && saveCancelled) SetCancellationError(); if (error == null) MakeCine(seconds); else if (frames > 0) RescueOnError(); SaveReport(); @@ -2181,6 +2189,11 @@ static void AudioNoteTranslated(List notes, string name, AudioCapture a) if (a.Joins > 0) { int fadeMs = AudioCapture.JoinFrames * 1000 / AudioCapture.Rate; + if (I18n.IsKorean) + { + notes.Add(I18n.Fmt("", "{0}: faded for {1} ms after each of {2} pauses.", name, fadeMs, a.Joins)); + return; + } string pause = a.Joins == 1 ? "the pause" : "each of the " + a.Joins + " pauses"; notes.Add(name + ": " + (I18n.IsGerman ? "Beim Fortsetzen nach " + (a.Joins == 1 ? "der Pause" : "jeder der " + a.Joins + " Pausen") + " wird der Ton " + fadeMs + " ms überblendet." @@ -2197,6 +2210,8 @@ internal static string ClipText(AudioCapture a) : total.ToString("0.0", I18n.IsSpanish ? CultureInfo.CurrentCulture : CultureInfo.InvariantCulture) + " s"; string when = first >= 3600 ? (first / 3600) + ":" + (first / 60 % 60).ToString("00") + ":" + (first % 60).ToString("00") : (first / 60) + ":" + (first % 60).ToString("00"); + if (I18n.IsKorean) + return I18n.Fmt("", "clipped {0} times (first at {1}, held at full scale for {2})", a.ClipEvents, when, held); if (I18n.IsGerman) return (a.ClipEvents == 1 ? "einmal übersteuert (bei " : a.ClipEvents + "-mal übersteuert (zuerst bei ") + when + ", " + held + " am Maximalpegel)"; if (!I18n.IsSpanish) @@ -2233,7 +2248,8 @@ void MakeCine(double seconds) { TryDelete(temp); masterTemp = null; - error = watch.Cancelled ? PassWatch.CancelledText : I18n.T("No se pudo crear el m\u00E1ster sin p\u00E9rdidas. ", "Could not create the lossless master. ") + failure; + if (watch.Cancelled) SetCancellationError(); + else error = I18n.T("No se pudo crear el m\u00E1ster sin p\u00E9rdidas. ", "Could not create the lossless master. ") + failure; RescueOnError(); return; } @@ -2409,7 +2425,7 @@ void Encode(string args, string label, double seconds, string failure) shown = pct; Ui(delegate { if (bar != null) bar.Converting(label, pct / 100.0); if (owner != null) owner.SavingShow(gif, label, pct / 100.0); }); }, errors); - if (watch.Cancelled) { if (error == null) error = PassWatch.CancelledText; } + if (watch.Cancelled) { if (error == null) SetCancellationError(); } else if (watch.Stalled) error = failure + " " + PassWatch.StalledText; else if (code != 0) error = failure + " " + Tail(); } @@ -2452,11 +2468,16 @@ void Done() if (poster != null) { poster.Dispose(); poster = null; } } + void SetCancellationError() + { + errorIsCancellation = true; + error = PassWatch.CancelledText; + } + // The failure, and the folder with what was kept when there is one. void ShowError() { - bool mine = saveCancelled && error.StartsWith(PassWatch.CancelledText, StringComparison.Ordinal); - MessageBoxIcon icon = mine ? MessageBoxIcon.Information : MessageBoxIcon.Warning; + MessageBoxIcon icon = saveCancelled && errorIsCancellation ? MessageBoxIcon.Information : MessageBoxIcon.Warning; if (rescueDir == null || !Directory.Exists(rescueDir)) { Dialogs.Show(error, "Stackshot", MessageBoxButtons.OK, icon); diff --git a/src/Capture/RegionPicker.cs b/src/Capture/RegionPicker.cs index ed8ab89..78132a0 100644 --- a/src/Capture/RegionPicker.cs +++ b/src/Capture/RegionPicker.cs @@ -920,6 +920,7 @@ void BuildHints() : mode == Mode.Text ? "Copy text \u00B7 Drag over text or click a window \u00B7 Esc: cancel" : mode == Mode.Gif ? "Record GIF \u00B7 Drag an area or click a window \u00B7 Esc: cancel" : "Scrolling capture \u00B7 Drag over the scrolling area, excluding fixed header \u00B7 Esc: cancel"; + text = I18n.Localize(text); } string icon = mode == Mode.Image ? "area" : mode == Mode.Video ? "video" : mode == Mode.Gif ? "gif" : mode == Mode.Text ? "textscan" : "scroll"; HintPart[] parts = SplitHint(text.Split(new string[] { " \u00B7 " }, StringSplitOptions.None)); diff --git a/src/Capture/ScrollCapture.cs b/src/Capture/ScrollCapture.cs index 6ce1bc5..c65ad42 100644 --- a/src/Capture/ScrollCapture.cs +++ b/src/Capture/ScrollCapture.cs @@ -927,7 +927,7 @@ string HeightText(int h) { if (h <= 0) return I18n.T("Preparando\u2026", "Preparing\u2026"); double screens = (double)h / Math.Max(1, session.AreaHeight); - string sc = screens < 1.05 ? I18n.T("1 pantalla", "1 screen") : screens.ToString("0.#", I18n.IsSpanish ? Es : CultureInfo.InvariantCulture) + (I18n.IsSpanish ? " pantallas" : " screens"); + string sc = screens < 1.05 ? I18n.T("1 pantalla", "1 screen") : screens.ToString("0.#", I18n.IsSpanish ? Es : CultureInfo.InvariantCulture) + I18n.T(" pantallas", " screens"); return sc + " \u00B7 " + h.ToString("N0", I18n.IsSpanish ? Es : CultureInfo.InvariantCulture) + " px"; } diff --git a/src/Capture/Sensitive.cs b/src/Capture/Sensitive.cs index 8de754c..198591a 100644 --- a/src/Capture/Sensitive.cs +++ b/src/Capture/Sensitive.cs @@ -1056,12 +1056,12 @@ static bool PhoneShape(List g) static readonly string[] OneEs = { "DNI", "NIE", "n.\u00BA de la Seguridad Social", "IBAN", "tarjeta", "correo", "tel\u00E9fono", "SSN", "clave secreta" }; static readonly string[] OneEn = { "ID (DNI)", "Foreigner ID (NIE)", "Social Security no.", "IBAN", "card", "email", "phone", "SSN", "secret key" }; static readonly string[] OneDe = { "DNI", "NIE", "Sozialversicherungsnummer", "IBAN", "Karte", "E-Mail-Adresse", "Telefonnummer", "SSN", "geheimer Schl\u00FCssel" }; - static string[] One { get { return I18n.IsSpanish ? OneEs : I18n.IsGerman ? OneDe : OneEn; } } + static string[] One { get { return I18n.IsSpanish ? OneEs : I18n.IsGerman ? OneDe : I18n.LocalizeList(OneEn); } } static readonly string[] ManyEs = { "DNI", "NIE", "n.\u00BA de la Seguridad Social", "IBAN", "tarjetas", "correos", "tel\u00E9fonos", "SSNs", "claves secretas" }; static readonly string[] ManyEn = { "IDs (DNI)", "Foreigner IDs (NIE)", "Social Security nos.", "IBANs", "cards", "emails", "phones", "SSNs", "secret keys" }; static readonly string[] ManyDe = { "DNI", "NIE", "Sozialversicherungsnummern", "IBANs", "Karten", "E-Mail-Adressen", "Telefonnummern", "SSNs", "geheime Schl\u00FCssel" }; - static string[] Many { get { return I18n.IsSpanish ? ManyEs : I18n.IsGerman ? ManyDe : ManyEn; } } + static string[] Many { get { return I18n.IsSpanish ? ManyEs : I18n.IsGerman ? ManyDe : I18n.LocalizeList(ManyEn); } } public static string Name(SensitiveKind k, int n) { return n == 1 ? One[(int)k] : Many[(int)k]; } @@ -1071,7 +1071,7 @@ public static string Summary(IList found) int[] count = new int[One.Length]; foreach (SensitiveFinding f in found) count[(int)f.Kind]++; List parts = new List(); - for (int i = 0; i < count.Length; i++) if (count[i] > 0) parts.Add(count[i] + " " + Name((SensitiveKind)i, count[i])); + for (int i = 0; i < count.Length; i++) if (count[i] > 0) parts.Add(I18n.IsKorean ? I18n.Fmt("", "{0}: {1} items", Name((SensitiveKind)i, count[i]), count[i]) : count[i] + " " + Name((SensitiveKind)i, count[i])); return string.Join(", ", parts.ToArray()); } } diff --git a/src/Card.cs b/src/Card.cs index f76fee0..b094f5d 100644 --- a/src/Card.cs +++ b/src/Card.cs @@ -62,6 +62,26 @@ public Card(ShotStack owner, string path) IsMedia = ShotStack.IsMediaFile(path); } + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + I18n.Changed += RefreshLanguage; + } + + protected override void OnHandleDestroyed(EventArgs e) + { + I18n.Changed -= RefreshLanguage; + base.OnHandleDestroyed(e); + } + + void RefreshLanguage() + { + if (IsDisposed || !IsHandleCreated) return; + if (InvokeRequired) { BeginInvoke((Action)RefreshLanguage); return; } + BuildButtons(); + Redraw(); + } + protected override bool PerPixel { get { return true; } } // Pressed, swiping or dragging: the stack must not move it to another monitor. diff --git a/src/Editor/Backdrop.cs b/src/Editor/Backdrop.cs index 24b4741..befcbb4 100644 --- a/src/Editor/Backdrop.cs +++ b/src/Editor/Backdrop.cs @@ -69,21 +69,21 @@ public static string Name(int i) switch (idx) { case 0: return "Stackshot"; - case 1: return "Sunset"; - case 2: return "Mint"; - case 3: return "Ocean"; - case 4: return "Peach"; - case 5: return "Lavender"; - case 6: return "Rose"; - case 7: return "Aurora"; - case 8: return "Night"; - case 9: return "Graphite"; - case 10: return "Light"; - case 11: return "Dark"; - case 12: return "Your desktop"; + case 1: return I18n.Localize("Sunset"); + case 2: return I18n.Localize("Mint"); + case 3: return I18n.Localize("Ocean"); + case 4: return I18n.Localize("Peach"); + case 5: return I18n.Localize("Lavender"); + case 6: return I18n.Localize("Rose"); + case 7: return I18n.Localize("Aurora"); + case 8: return I18n.Localize("Night"); + case 9: return I18n.Localize("Graphite"); + case 10: return I18n.Localize("Light"); + case 11: return I18n.Localize("Dark"); + case 12: return I18n.Localize("Your desktop"); } if (n != null && n.StartsWith("Tu imagen ")) - return "Your image " + n.Substring("Tu imagen ".Length); + return I18n.Localize("Your image ") + n.Substring("Tu imagen ".Length); return n; } diff --git a/src/Editor/BgPanel.Access.cs b/src/Editor/BgPanel.Access.cs index d19bd9c..5ec18bd 100644 --- a/src/Editor/BgPanel.Access.cs +++ b/src/Editor/BgPanel.Access.cs @@ -46,7 +46,7 @@ sealed class PanelAccess : PartsAccessible protected override string Signature() { StringBuilder b = new StringBuilder(); - b.Append(p.Width).Append('|').Append(p.Height).Append('|').Append(p.scroll).Append('|').Append(p.On).Append('|').Append(p.Enabled).Append('|').Append(p.items.Count); + b.Append(I18n.Language).Append('|').Append(p.Width).Append('|').Append(p.Height).Append('|').Append(p.scroll).Append('|').Append(p.On).Append('|').Append(p.Enabled).Append('|').Append(p.items.Count); Settings s = p.Bg; if (s != null) b.Append('|').Append(s.BgKind).Append('|').Append(s.BgPreset).Append('|').Append(s.BgColor).Append('|').Append(s.BgBlur) @@ -82,7 +82,7 @@ protected override void Fill(List into) a.PartState = StateOf(p.Enabled, p.On && p.KindNow == 2 && bg.BgBlur == it.Index, false); break; case Kind.Plain: - a = NewPart(into, "Color " + it.Label.ToLowerInvariant(), AccessibleRole.RadioButton, r); + a = NewPart(into, I18n.Fmt("Color {0}", "Color {0}", it.Label.ToLowerInvariant()), AccessibleRole.RadioButton, r); a.PartState = StateOf(p.Enabled, p.On && p.KindNow == 1 && (bg.BgColor & 0xFFFFFF) == it.Index, false); break; case Kind.Slider: diff --git a/src/Editor/BgPanel.Styles.cs b/src/Editor/BgPanel.Styles.cs index ba42aa5..b965fd1 100644 --- a/src/Editor/BgPanel.Styles.cs +++ b/src/Editor/BgPanel.Styles.cs @@ -118,7 +118,7 @@ public static string Name(string style) if (n[0] == 1) { int rgb = n[2] & 0xFFFFFF, at = Array.IndexOf(Plains, rgb); - b.Append(at >= 0 ? "Color " + PlainNames[at].ToLowerInvariant() : "Color #" + rgb.ToString("X6", CultureInfo.InvariantCulture)); + b.Append(I18n.Fmt("Color {0}", "Color {0}", at >= 0 ? PlainNames[at].ToLowerInvariant() : "#" + rgb.ToString("X6", CultureInfo.InvariantCulture))); } else if (n[0] == 2) b.Append(BlurNames[Clamp(n[3], 0, 2)]); else b.Append(n[1] >= 0 && n[1] < Backdrop.Count ? Backdrop.Name(n[1]) : Backdrop.Name(0)); diff --git a/src/Editor/BgPanel.cs b/src/Editor/BgPanel.cs index b4ece60..c047f3d 100644 --- a/src/Editor/BgPanel.cs +++ b/src/Editor/BgPanel.cs @@ -27,7 +27,8 @@ class Item public const float Wide = 252; // width at 100 % static readonly string[] Ratios = { "auto", "16:9", "4:3", "1:1" }; - static readonly string[] RatioNames = { "Auto", "16:9", "4:3", "1:1" }; + static readonly string[] RatioLabels = { "Auto", "16:9", "4:3", "1:1" }; + static string[] RatioNames { get { return I18n.LocalizeList(RatioLabels); } } static readonly int[] Plains = { 0x000000, 0xFFFFFF, 0xE5383B, 0xF3722C, 0xF9C74F, 0x2B9348, 0x1D72E8, 0x7B2CBF, 0xE84393, @@ -48,11 +49,11 @@ class Item "Schwarz", "Weiß", "Rot", "Orange", "Gelb", "Grün", "Blau", "Violett", "Rosa", "Dunkelgrau", "Hellgrau", "Zartrot", "Zartorange", "Zartgelb", "Zartgrün", "Zartblau", "Zartviolett" }; - static string[] PlainNames { get { return I18n.IsSpanish ? PlainNamesEs : I18n.IsGerman ? PlainNamesDe : PlainNamesEn; } } + static string[] PlainNames { get { return I18n.IsSpanish ? PlainNamesEs : I18n.IsGerman ? PlainNamesDe : I18n.LocalizeList(PlainNamesEn); } } static readonly string[] BlurNamesEs = { "Desenfocada", "Desenfocada y oscura", "Desenfocada y clara" }; static readonly string[] BlurNamesEn = { "Blurred", "Blurred & dark", "Blurred & light" }; static readonly string[] BlurNamesDe = { "Unscharf", "Unscharf und dunkel", "Unscharf und hell" }; - static string[] BlurNames { get { return I18n.IsSpanish ? BlurNamesEs : I18n.IsGerman ? BlurNamesDe : BlurNamesEn; } } + static string[] BlurNames { get { return I18n.IsSpanish ? BlurNamesEs : I18n.IsGerman ? BlurNamesDe : I18n.LocalizeList(BlurNamesEn); } } static readonly string[] AlignNamesEs = { "Arriba a la izquierda", "Arriba", "Arriba a la derecha", "A la izquierda", "Centrada", "A la derecha", @@ -64,11 +65,11 @@ class Item "Bottom left", "Bottom", "Bottom right" }; static readonly string[] AlignNamesDe = { "Oben links", "Oben", "Oben rechts", "Links", "Zentriert", "Rechts", "Unten links", "Unten", "Unten rechts" }; - static string[] AlignNames { get { return I18n.IsSpanish ? AlignNamesEs : I18n.IsGerman ? AlignNamesDe : AlignNamesEn; } } + static string[] AlignNames { get { return I18n.IsSpanish ? AlignNamesEs : I18n.IsGerman ? AlignNamesDe : I18n.LocalizeList(AlignNamesEn); } } static readonly string[] SliderNamesEs = { "Margen", "Esquinas", "Sombra", "Inserci\u00F3n" }; static readonly string[] SliderNamesEn = { "Padding", "Corners", "Shadow", "Border inset" }; static readonly string[] SliderNamesDe = { "Abstand", "Ecken", "Schatten", "Randabstand" }; - static string[] SliderNames { get { return I18n.IsSpanish ? SliderNamesEs : I18n.IsGerman ? SliderNamesDe : SliderNamesEn; } } + static string[] SliderNames { get { return I18n.IsSpanish ? SliderNamesEs : I18n.IsGerman ? SliderNamesDe : I18n.LocalizeList(SliderNamesEn); } } static bool allGradients = true; // "Ver menos" folds them to one row, for the rest of the session public float S = 1f; diff --git a/src/Editor/Canvas.cs b/src/Editor/Canvas.cs index fc270ff..88f0f81 100644 --- a/src/Editor/Canvas.cs +++ b/src/Editor/Canvas.cs @@ -735,7 +735,7 @@ void FloatShadow(Graphics g, Rectangle r) static readonly string[] PillTipsEs = { "Alejar (Ctrl+\u2212)", "Tama\u00F1o real (Ctrl+1)", "Acercar (Ctrl++)", "Ajustar a la ventana (Ctrl+0)" }; static readonly string[] PillTipsEn = { "Zoom out (Ctrl+\u2212)", "Actual size (Ctrl+1)", "Zoom in (Ctrl++)", "Fit to window (Ctrl+0)" }; static readonly string[] PillTipsDe = { "Verkleinern (Strg+\u2212)", "Originalgröße (Strg+1)", "Vergrößern (Strg++)", "An Fenster anpassen (Strg+0)" }; - static string[] PillTips { get { return I18n.IsSpanish ? PillTipsEs : I18n.IsGerman ? PillTipsDe : PillTipsEn; } } + static string[] PillTips { get { return I18n.IsSpanish ? PillTipsEs : I18n.IsGerman ? PillTipsDe : I18n.LocalizeList(PillTipsEn); } } static string PillFitText { get { return I18n.T("Ajustar", "Fit"); } } int pillHot = -1, pillDown = -1; @@ -747,14 +747,14 @@ void FloatShadow(Graphics g, Rectangle r) // 0 minus, 1 percentage, 2 plus, 3 fit; the last rectangle is the whole capsule. int pillFitW = -1; - bool pillFitLang = true; + string pillFitLang; Rectangle[] PillParts() { int h = Pu(30), bw = Pu(30), pw = Pu(50); - if (pillFitW < 0 || pillFitLang != I18n.IsSpanish) + if (pillFitW < 0 || pillFitLang != I18n.Language) { - pillFitLang = I18n.IsSpanish; + pillFitLang = I18n.Language; pillFitW = TextKit.Measure(PillFitText, PillFont, Size.Empty, TextFormatFlags.NoPadding).Width; } int fw = pillFitW + Pu(26); diff --git a/src/Editor/Editor.Sensitive.cs b/src/Editor/Editor.Sensitive.cs index c5f1a82..d9ae7af 100644 --- a/src/Editor/Editor.Sensitive.cs +++ b/src/Editor/Editor.Sensitive.cs @@ -134,6 +134,13 @@ void SensitiveFound(List found, string error, Point origin) // What the hint strip says after a search. added: how many of found this search covered (the rest already were). internal static string SensitiveResult(IList found, int added) { + if (I18n.IsKorean) + { + if (found.Count == 0) return I18n.Localize("No sensitive data found."); + if (added == 0) return I18n.Localize("Sensitive data is already redacted."); + if (added < found.Count) return I18n.Fmt("", "Redacted {0} more items; {1} were already covered.", added, found.Count - added); + return I18n.Fmt("", "{0} items redacted: {1}. You can remove the marks.", added, Sensitive.Summary(found)); + } if (I18n.IsGerman) { if (found.Count == 0) return "Keine sensiblen Daten gefunden."; diff --git a/src/Editor/Editor.cs b/src/Editor/Editor.cs index 9e133bb..7dc8c97 100644 --- a/src/Editor/Editor.cs +++ b/src/Editor/Editor.cs @@ -20,7 +20,7 @@ public partial class Editor : Form static readonly string[] ToolNamesEs = { "Flecha", "L\u00EDnea", "Recuadro", "Elipse", "Texto", "N\u00FAmeros", "Resaltar", "Foco: oscurece el resto", "Pixelar", "Tapar (lo m\u00E1s seguro para datos)", "Recortar" }; static readonly string[] ToolNamesEn = { "Arrow", "Line", "Rectangle", "Ellipse", "Text", "Numbers", "Highlight", "Spotlight: dims the rest", "Pixelate", "Redact (safest for sensitive data)", "Crop" }; static readonly string[] ToolNamesDe = { "Pfeil", "Linie", "Rechteck", "Ellipse", "Text", "Zahlen", "Hervorheben", "Scheinwerfer: dunkelt den Rest ab", "Verpixeln", "Schw\u00E4rzen (am sichersten f\u00FCr Daten)", "Zuschneiden" }; - static string[] ToolNames { get { return I18n.IsSpanish ? ToolNamesEs : I18n.IsGerman ? ToolNamesDe : ToolNamesEn; } } + static string[] ToolNames { get { return I18n.IsSpanish ? ToolNamesEs : I18n.IsGerman ? ToolNamesDe : I18n.LocalizeList(ToolNamesEn); } } static readonly string[] ToolKeysEs = { "F", "L", "R", "E", "T", "N", "H", "O", "P", "X", "C" }; static readonly string[] ToolKeysEn = { "A", "L", "R", "E", "T", "N", "H", "S", "P", "X", "C" }; static readonly string[] ToolKeysDe = { "A", "L", "R", "E", "T", "N", "H", "S", "P", "X", "C" }; @@ -29,11 +29,11 @@ public partial class Editor : Form static readonly string[] WeightNamesEs = { "Fino", "Medio", "Grueso" }; static readonly string[] WeightNamesEn = { "Thin", "Medium", "Thick" }; static readonly string[] WeightNamesDe = { "D\u00FCnn", "Mittel", "Dick" }; - static string[] WeightNames { get { return I18n.IsSpanish ? WeightNamesEs : I18n.IsGerman ? WeightNamesDe : WeightNamesEn; } } + static string[] WeightNames { get { return I18n.IsSpanish ? WeightNamesEs : I18n.IsGerman ? WeightNamesDe : I18n.LocalizeList(WeightNamesEn); } } static readonly string[] SizeNamesEs = { "Peque\u00F1o", "Mediano", "Grande" }; static readonly string[] SizeNamesEn = { "Small", "Medium", "Large" }; static readonly string[] SizeNamesDe = { "Klein", "Mittel", "Gro\u00DF" }; - static string[] SizeNames { get { return I18n.IsSpanish ? SizeNamesEs : I18n.IsGerman ? SizeNamesDe : SizeNamesEn; } } + static string[] SizeNames { get { return I18n.IsSpanish ? SizeNamesEs : I18n.IsGerman ? SizeNamesDe : I18n.LocalizeList(SizeNamesEn); } } // Captures that already have the backdrop applied, so reopening them doesn't add a second one. static readonly HashSet withBackdrop = new HashSet(StringComparer.OrdinalIgnoreCase); @@ -508,6 +508,8 @@ void RefreshLanguage() if (InvokeRequired) { BeginInvoke((Action)RefreshLanguage); return; } EdTip.Cancel(); foreach (Action refresh in toolbarText) refresh(); + bgPanel.Relayout(); + canvas.Invalidate(); UpdateUi(); MinimumSize = new Size(Math.Min(Screen.FromControl(this).WorkingArea.Width, bar.LayoutItems()), P(380)); bar.Invalidate(); diff --git a/src/Editor/PlayerKit.cs b/src/Editor/PlayerKit.cs index 603b616..850c4b5 100644 --- a/src/Editor/PlayerKit.cs +++ b/src/Editor/PlayerKit.cs @@ -318,6 +318,12 @@ public static void ResumeSave(string path, double pos, double duration) // Label and value pairs of the info panel. public static List Describe(MediaInfo m, string path, long fileBytes, string cineJson) + { + int scaleRow; + return Describe(m, path, fileBytes, cineJson, out scaleRow); + } + + internal static List Describe(MediaInfo m, string path, long fileBytes, string cineJson, out int scaleRow) { List r = new List(); string raw = m.Raw ?? ""; @@ -330,10 +336,11 @@ public static List Describe(MediaInfo m, string path, long fileBytes, Size seen = m.Display; if (m.HasVideo) r.Add(new string[] { I18n.T("Tama\u00F1o", "Size"), m.Width + " \u00D7 " + m.Height + (seen.Width == m.Width && seen.Height == m.Height ? "" : I18n.Fmt(" (p\u00EDxeles no cuadrados {0}:{1}, se ve a {2} \u00D7 {3})", " (non-square pixels {0}:{1}, displayed as {2} \u00D7 {3})", m.SarNum, m.SarDen, seen.Width, seen.Height)) }); + scaleRow = r.Count; if (m.Fps > 0) r.Add(new string[] { I18n.T("Fotogramas por segundo", "Frames per second"), Dec(m.Fps, "0.##") }); if (m.Duration > 0) r.Add(new string[] { I18n.T("Duraci\u00F3n", "Duration"), Clock(m.Duration) }); MatchCollection au = Regex.Matches(raw, @"Stream #\d+:\d+[^\n]*?: Audio: ([^\s,]+)(?: \(([^)]*)\))?[^,\n]*, (\d+) Hz, ([^,\n]+)"); - if (m.Audio.Count == 0) r.Add(new string[] { "Audio", I18n.T("Sin sonido", "No audio") }); + if (m.Audio.Count == 0) r.Add(new string[] { I18n.Localize("Audio"), I18n.T("Sin sonido", "No audio") }); for (int i = 0; i < m.Audio.Count; i++) { string title = string.IsNullOrEmpty(m.Audio[i].Title) ? I18n.Fmt("Pista {0}", "Track {0}", i + 1) : Cine.TrackName(m.Audio[i].Title); @@ -344,7 +351,7 @@ public static List Describe(MediaInfo m, string path, long fileBytes, if (layout == "stereo") layout = I18n.T("est\u00E9reo", "stereo"); detail = au[i].Groups[1].Value + " \u00B7 " + layout + " \u00B7 " + au[i].Groups[3].Value + " Hz"; } - r.Add(new string[] { m.Audio.Count > 1 ? "Audio " + (i + 1) : "Audio", title + (detail.Length > 0 ? " \u00B7 " + detail : "") }); + r.Add(new string[] { m.Audio.Count > 1 ? I18n.Fmt("Audio {0}", "Audio {0}", i + 1) : I18n.Localize("Audio"), title + (detail.Length > 0 ? " \u00B7 " + detail : "") }); } if (fileBytes > 0) r.Add(new string[] { I18n.T("Tama\u00F1o del archivo", "File size"), Bytes(fileBytes) }); bool passed = false, known = false; diff --git a/src/Editor/PlayerWindow.cs b/src/Editor/PlayerWindow.cs index 8cc3281..dfded7b 100644 --- a/src/Editor/PlayerWindow.cs +++ b/src/Editor/PlayerWindow.cs @@ -40,6 +40,7 @@ enum Drag { None, Seek, Volume } MediaInfo info; Playback play; List infoRows = new List(); + int scaleRow; double markIn = -1, markOut = -1; // the piece to export (E and S on the bar), -1 when not set bool grabbing; @@ -138,18 +139,15 @@ void Open(string file) Cursor.Current = Cursors.WaitCursor; try { info = MediaInfo.ProbeCached(ffmpeg, file); } finally { Cursor.Current = Cursors.Default; } - long bytes = 0; - try { bytes = new FileInfo(file).Length; } - catch (Exception) { } if (!info.CanPlay) { - message = !File.Exists(file) ? "No se encuentra el archivo." : "No se puede reproducir este archivo: FFmpeg no encuentra un v\u00EDdeo que mostrar."; + message = MissingVideoMessage(); if (ClientSize.Width < P(560)) ClientSize = new Size(P(640), P(360)); infoRows = new List(); Invalidate(); return; } - infoRows = PlayerKit.Describe(info, file, bytes, PlayerKit.IsMaster(info) ? PlayerKit.ReadCineReport(file) : null); + RefreshInfoRows(); Size video = info.Display; if (!fullscreen && WindowState == FormWindowState.Normal) { @@ -210,6 +208,29 @@ void DisposePlayback() if (p != null) p.Dispose(); } + string MissingVideoMessage() + { + return !File.Exists(path) ? I18n.T("No se encuentra el archivo.", "File not found.") + : I18n.T("No se puede reproducir este archivo: FFmpeg no encuentra un v\u00EDdeo que mostrar.", "FFmpeg could not find a video stream to play in this file."); + } + + void RefreshInfoRows() + { + long bytes = 0; + try { bytes = new FileInfo(path).Length; } + catch (Exception) { } + infoRows = PlayerKit.Describe(info, path, bytes, PlayerKit.IsMaster(info) ? PlayerKit.ReadCineReport(path) : null, out scaleRow); + } + + void RefreshLanguage() + { + if (IsDisposed || !IsHandleCreated) return; + if (InvokeRequired) { OnUi(RefreshLanguage); return; } + if (info != null && info.CanPlay) RefreshInfoRows(); + else if (info != null) message = MissingVideoMessage(); + Invalidate(); + } + void OnUi(Action a) { try { BeginInvoke((Action)delegate { if (!IsDisposed) a(); }); } @@ -575,7 +596,7 @@ void OpenDialog() if (exportThread != null) return; using (OpenFileDialog d = new OpenFileDialog()) { - d.Title = "Abrir v\u00EDdeo"; + d.Title = I18n.T("Abrir v\u00EDdeo", "Open video"); d.Filter = ShotStack.VideoFilter; if (d.ShowDialog(this) == DialogResult.OK) OpenAndPlay(d.FileName); } @@ -650,13 +671,16 @@ void ExportMp4() if (VideoExport.TargetBytes(spec.Level) > 0 && dur <= 0) { ShotStack.Unreserve(output); - Alert("No se sabe cu\u00E1nto dura este v\u00EDdeo, as\u00ED que no se puede ajustar a " + Timeline.Qualities[spec.Level] + ". Marca un tramo (E y S) o elige otra calidad en M\u00E1s opciones > Calidad al exportar."); + Alert(I18n.Fmt("No se sabe cu\u00E1nto dura este v\u00EDdeo, as\u00ED que no se puede ajustar a {0}. Marca un tramo (E y S) o elige otra calidad en M\u00E1s opciones > Calidad al exportar.", + "Cannot fit a video of unknown duration into {0}. Mark a clip (E and S) or change More options > Export quality.", Timeline.Qualities[spec.Level])); return; } if (VideoExport.TargetBytes(spec.Level) > 0 && VideoExport.TargetKbps(spec) < VideoExport.TargetMinKbps) { ShotStack.Unreserve(output); - Alert("Es demasiado largo para caber en " + Timeline.Qualities[spec.Level] + " con buena calidad (caben " + VideoExport.MaxLength(spec.Level, spec.HasAudio) + "). Marca un tramo m\u00E1s corto (E y S) o elige otra calidad en M\u00E1s opciones > Calidad al exportar."); + Alert(I18n.Fmt("Es demasiado largo para caber en {0} con buena calidad (caben {1}). Marca un tramo m\u00E1s corto (E y S) o elige otra calidad en M\u00E1s opciones > Calidad al exportar.", + "Too long to fit into {0} at good quality (limit: {1}). Mark a shorter clip (E and S) or change More options > Export quality.", + Timeline.Qualities[spec.Level], VideoExport.MaxLength(spec.Level, spec.HasAudio))); return; } string log = Path.Combine(Path.GetTempPath(), "stackshot-2pass-" + Guid.NewGuid().ToString("N")); @@ -667,7 +691,7 @@ void ExportMp4() ExportAbort ab = new ExportAbort(); exportAbort = ab; exportOut = output; - exportText = "Creando el MP4\u2026 0 % \u00B7 Esc cancela"; + exportText = Mp4Progress(0); Invalidate(); ShotStack.Log("Reproductor: exportando " + Path.GetFileName(output)); System.Threading.Thread t = new System.Threading.Thread(delegate() @@ -683,13 +707,13 @@ void ExportMp4() TimeSpan ts; if (!TimeSpan.TryParse(line.Substring(9).Trim(), CultureInfo.InvariantCulture, out ts)) return; int pc = (int)Math.Round((done + Math.Max(0, Math.Min(1, ts.TotalSeconds / dur))) / count * 100); - OnUi(delegate { if (exportAbort == ab) { exportText = "Creando el MP4\u2026 " + pc + " % \u00B7 Esc cancela"; Invalidate(); } }); + OnUi(delegate { if (exportAbort == ab) { exportText = Mp4Progress(pc); Invalidate(); } }); }, out err); VideoExport.DeletePassLog(log); ShareReport rep = null; if (!ab.Set && code == 0 && File.Exists(output)) { - OnUi(delegate { if (exportAbort == ab) { exportText = "Comprobando el v\u00EDdeo\u2026 \u00B7 Esc cancela"; Invalidate(); } }); + OnUi(delegate { if (exportAbort == ab) { exportText = I18n.T("Comprobando el v\u00EDdeo\u2026 \u00B7 Esc cancela", "Checking video\u2026 \u00B7 Esc cancels"); Invalidate(); } }); rep = ShareCheck.Validate(ff, output, expect); } OnUi(delegate { ExportDone(ab, output, code, err, rep); }); @@ -744,6 +768,11 @@ void ExportDone(ExportAbort ab, string output, int code, string err, ShareReport string exportNote; internal string ExportNote { get { return exportNote; } } + static string Mp4Progress(int percent) + { + return I18n.Fmt("Creando el MP4\u2026 {0} % \u00B7 Esc cancela", "Creating MP4\u2026 {0}% \u00B7 Esc cancels", percent); + } + void Alert(string text) { exportNote = text; @@ -1046,7 +1075,7 @@ void ShowSpeeds() foreach (double v in PlayerKit.Speeds) { double sp = v; - ToolStripMenuItem it = TrayMenu.Item(PlayerKit.SpeedText(sp) + (sp == 1 ? " (normal)" : ""), null, delegate { SetSpeed(sp); }); + ToolStripMenuItem it = TrayMenu.Item(PlayerKit.SpeedText(sp) + (sp == 1 ? I18n.Localize(" (normal)") : ""), null, delegate { SetSpeed(sp); }); it.Checked = Math.Abs(speed - sp) < 1e-9; m.Items.Add(it); } @@ -1061,7 +1090,7 @@ void ShowMenu(Point at, Btn b) if (CanEdit) m.Items.Add(TrayMenu.Item(I18n.T("Editar", "Edit"), "edit", delegate { Edit(); })); if (CanExport) m.Items.Add(TrayMenu.Item(HasRange ? I18n.T("Exportar el tramo", "Export clip") : I18n.T("Exportar MP4", "Export MP4"), "share", delegate { ExportMp4(); })); if (info.CanPlay && exportThread == null) m.Items.Add(GifMenuItem()); - m.Items.Add(TrayMenu.Item((I18n.IsSpanish ? "Calidad al exportar: " : "Export quality: ") + QualityName(settings.ExportQuality) + "\u2026", null, delegate { OnUi(delegate { ShowQuality(at, b); }); })); + m.Items.Add(TrayMenu.Item(I18n.T("Calidad al exportar: ", "Export quality: ") + QualityName(settings.ExportQuality) + "\u2026", null, delegate { OnUi(delegate { ShowQuality(at, b); }); })); m.Items.Add(TrayMenu.Item(I18n.T("Capturar este fotograma", "Capture this frame"), "photo", "C", delegate { GrabFrame(); })); m.Items.Add(TrayMenu.Item(I18n.T("Marcar el inicio del tramo", "Set in-point"), null, "E", delegate { MarkIn(); })); m.Items.Add(TrayMenu.Item(I18n.T("Marcar el final del tramo", "Set out-point"), null, "S", delegate { MarkOut(); })); @@ -1103,7 +1132,7 @@ void ShowMenu(Point at, Btn b) static string QualityName(int q) { q = Math.Max(0, Math.Min(Timeline.Qualities.Length - 1, q)); - return Timeline.Qualities[q] + (q == 3 ? " (WhatsApp)" : q == 4 ? (I18n.IsSpanish ? " (correo)" : " (email)") : ""); + return Timeline.Qualities[q] + (q == 3 ? " (WhatsApp)" : q == 4 ? I18n.T(" (correo)", " (email)") : ""); } // The export quality, shared with the editor; 16 MB and 25 MB fit the file in that size. @@ -1113,7 +1142,7 @@ void ShowQuality(Point at, Btn b) for (int i = 0; i < Timeline.Qualities.Length; i++) { int q = i; - ToolStripMenuItem it = TrayMenu.Item(QualityName(q), null, delegate { settings.ExportQuality = q; Remember(); Flash((I18n.IsSpanish ? "Calidad al exportar: " : "Export quality: ") + QualityName(q)); }); + ToolStripMenuItem it = TrayMenu.Item(QualityName(q), null, delegate { settings.ExportQuality = q; Remember(); Flash(I18n.T("Calidad al exportar: ", "Export quality: ") + QualityName(q)); }); it.Checked = settings.ExportQuality == q; m.Items.Add(it); } @@ -1205,9 +1234,7 @@ void PaintInfo(Graphics g) List rows = new List(infoRows); // Right under the video's size: how big it is shown now. string scale = PlayerKit.ScaleNote(info.Display, VideoRect(), !fullscreen && WindowState != FormWindowState.Maximized); - // The rows were made when the video opened, in the language of that moment. - int at = rows.FindIndex(x => x[0] == "Tama\u00F1o" || x[0] == "Size"); - if (scale.Length > 0) rows.Insert(at >= 0 ? at + 1 : rows.Count, new string[] { I18n.T("En pantalla", "On screen"), scale }); + if (scale.Length > 0) rows.Insert(scaleRow, new string[] { I18n.T("En pantalla", "On screen"), scale }); if (play != null) rows.Add(new string[] { I18n.T("Reproducci\u00F3n", "Playback"), I18n.Fmt("{0} fotogramas mostrados, {1} omitidos", "{0} frames shown, {1} dropped", play.FramesShown, play.FramesDropped) }); int h = pad * 2 + P(26) + rows.Count * rowH; int floor = (bar.IsEmpty ? ClientSize.Height : bar.Y) - P(12); @@ -1361,6 +1388,7 @@ void PaintBar(Graphics g) protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); + I18n.Changed += RefreshLanguage; try { int dark = 1; @@ -1371,6 +1399,12 @@ protected override void OnHandleCreated(EventArgs e) catch (Exception) { } } + protected override void OnHandleDestroyed(EventArgs e) + { + I18n.Changed -= RefreshLanguage; + base.OnHandleDestroyed(e); + } + protected override void OnShown(EventArgs e) { base.OnShown(e); diff --git a/src/Editor/ShareCheck.cs b/src/Editor/ShareCheck.cs index 3477e9b..9c0cb61 100644 --- a/src/Editor/ShareCheck.cs +++ b/src/Editor/ShareCheck.cs @@ -87,7 +87,7 @@ internal static class ShareCheck internal static string NameVideo { get { return I18n.T("V\u00EDdeo", "Video"); } } internal static string NameSize { get { return I18n.T("Tama\u00F1o", "Size"); } } internal static string NameFps { get { return I18n.T("Fotogramas por segundo", "Frames per second"); } } - internal static string NameColor { get { return "Color"; } } + internal static string NameColor { get { return I18n.Localize("Color"); } } internal static string NameAudio { get { return I18n.T("Sonido", "Sound"); } } internal static string NameDuration { get { return I18n.T("Duraci\u00F3n", "Duration"); } } internal static string NameDecode { get { return I18n.T("Lectura completa", "Full read"); } } diff --git a/src/Editor/Timeline.cs b/src/Editor/Timeline.cs index a4e482e..b221b50 100644 --- a/src/Editor/Timeline.cs +++ b/src/Editor/Timeline.cs @@ -36,7 +36,8 @@ public class Timeline : Control static readonly string[] QualitiesEs = { "M\u00E1xima", "Alta", "Ligera", "16 MB", "25 MB" }; static readonly string[] QualitiesEn = { "Maximum", "High", "Light", "16 MB", "25 MB" }; static readonly string[] QualitiesDe = { "Maximum", "Hoch", "Leicht", "16 MB", "25 MB" }; - public static string[] Qualities { get { return I18n.IsSpanish ? QualitiesEs : I18n.IsGerman ? QualitiesDe : QualitiesEn; } } + static readonly string[] QualitiesKo = { "\uCD5C\uACE0", "\uB192\uC74C", "\uACBD\uB7C9", "16 MB", "25 MB" }; + public static string[] Qualities { get { return I18n.IsSpanish ? QualitiesEs : I18n.IsGerman ? QualitiesDe : I18n.IsKorean ? QualitiesKo : QualitiesEn; } } public static readonly string[] Formats = { "MP4", "GIF" }; public int Speed, OutSize, Quality, Format; readonly Rectangle[][] segs = new Rectangle[4][]; @@ -611,9 +612,9 @@ int PaintCutButtons(Graphics g, Palette pal, Rectangle r, Font f) int PaintOptions(Graphics g, Palette pal, Rectangle r, Font f, int minLeft) { int leftmost = r.Right; - string[][] groups = { Speeds, Sizes, Qualities, Formats }; + string[][] groups = { Speeds, I18n.LocalizeList(Sizes), Qualities, Formats }; int[] sel = { Speed, OutSize, Quality, Format }; - string[] labels = { I18n.T("Velocidad", "Speed"), I18n.T("Tama\u00F1o", "Size"), I18n.T("Calidad", "Quality"), I18n.T("Formato", "Format") }; + string[] labels = { I18n.T("Velocidad", "Speed"), I18n.T("Tama\u00F1o", "Size"), I18n.T("Calidad", "Quality"), I18n.IsKorean ? I18n.Localize("File format") : I18n.T("Formato", "Format") }; Font fs = Fonts.Get(EdLook.Semibold, 11.5f * S), fr = Fonts.Get(EdLook.Text, 11.5f * S); const TextFormatFlags C = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.NoPadding | TextFormatFlags.SingleLine; int x = r.Right, h = P(24), y = P(7); diff --git a/src/Editor/VideoExport.cs b/src/Editor/VideoExport.cs index 5f9c7d2..086213c 100644 --- a/src/Editor/VideoExport.cs +++ b/src/Editor/VideoExport.cs @@ -407,7 +407,7 @@ internal static string Arguments(ExportSpec s) internal static string Arguments(ExportSpec s, int pass, string log) { // The editor never keeps a piece shorter than 0.05 s; FFmpeg would refuse an empty or reversed one (-to before -ss). - if (s.Keep != null) foreach (double[] k in s.Keep) if (!(k[1] > k[0])) throw new ArgumentException("A kept piece must end after it starts."); + if (s.Keep != null) foreach (double[] k in s.Keep) if (!(k[1] > k[0])) throw new ArgumentException(I18n.Localize("A kept piece must end after it starts.")); Rectangle crop = s.Crop; bool clips = s.Clips != null && s.Clips.Count > 1; List segs = clips ? ClipSeq.Segments(s.Clips, s.Keep) : null; diff --git a/src/FileAssoc.cs b/src/FileAssoc.cs index 2300d83..6af5820 100644 --- a/src/FileAssoc.cs +++ b/src/FileAssoc.cs @@ -12,7 +12,7 @@ public sealed class AssocKind public readonly string ProgId, FriendlyEs, FriendlyEn; public readonly string[] Exts; // The type's name as Explorer shows it, in the language in use when it is registered. - public string Friendly { get { return I18n.IsSpanish ? FriendlyEs : FriendlyEn; } } + public string Friendly { get { return I18n.IsSpanish ? FriendlyEs : I18n.Localize(FriendlyEn); } } public AssocKind(string progId, string friendlyEs, string friendlyEn, params string[] exts) { ProgId = progId; FriendlyEs = friendlyEs; FriendlyEn = friendlyEn; Exts = exts; } } diff --git a/src/Home/GoogleHealth.cs b/src/Home/GoogleHealth.cs index 674c971..0e71afd 100644 --- a/src/Home/GoogleHealth.cs +++ b/src/Home/GoogleHealth.cs @@ -154,7 +154,7 @@ enum Mark { Ok, Off, Fail } static void Answer(NetworkStream s, int code, Mark mark, string title, string word, string text) { string icon = mark == Mark.Ok ? "M5 12.5l4.5 4.5L19 7.5" : mark == Mark.Off ? "M7.5 7.5l9 9M16.5 7.5l-9 9" : "M12 6.5v7M12 17.5v.01"; - string html = "Stackshot