From d9626b04b28198992ab0def50946aa35262dceb8 Mon Sep 17 00:00:00 2001 From: Daniel Saidi Date: Mon, 4 Mar 2024 16:17:41 +0100 Subject: [PATCH] Refactor localization --- RELEASE_NOTES.md | 5 +- .../Commands/RichTextCommand+FormatMenu.swift | 6 +- .../RichTextKit/Localization/RTKL10n.swift | 55 ++++++++++--------- .../Resources/da.lproj/Localizable.strings | 36 ++++++------ .../Resources/de.lproj/Localizable.strings | 35 ++++++------ .../Resources/en.lproj/Localizable.strings | 35 ++++++------ .../Resources/nb.lproj/Localizable.strings | 35 ++++++------ .../Resources/sv.lproj/Localizable.strings | 36 ++++++------ 8 files changed, 126 insertions(+), 117 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 157c8a2f3..2f8d2cea5 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -19,12 +19,11 @@ This release removes all deprecated code and cleans up the library. * All previously deprecated code has been deleted. -* `RichTextContextFocusedValueKey` has been renamed to `RichTextContext.FocusedValueKey` +* `RichTextContextFocusedValueKey` has been renamed to `RichTextContext.FocusedValueKey`. * `RichTextEditor` is now configured and styled with view modifiers instead of with the initializer. * `RichTextFont` pickers are now configured with a shared view modifier instead of with the initializer. * `RichTextKeyboardToolbar` is now configured and styled with view modifiers instead of with the initializer. - - +* `RTKL10n` has renamed many localization keys. diff --git a/Sources/RichTextKit/Commands/RichTextCommand+FormatMenu.swift b/Sources/RichTextKit/Commands/RichTextCommand+FormatMenu.swift index 4a026d84f..8c3f42789 100644 --- a/Sources/RichTextKit/Commands/RichTextCommand+FormatMenu.swift +++ b/Sources/RichTextKit/Commands/RichTextCommand+FormatMenu.swift @@ -69,7 +69,7 @@ public extension RichTextCommand.FormatMenu { public var body: some View { switch self { case .font: - Menu(RTKL10n.menuFont.text) { + Menu(RTKL10n.font.text) { Group(styles: .all) Divider() Group(fontSize: true) @@ -79,7 +79,7 @@ public extension RichTextCommand.FormatMenu { Group(alignments: .all) } case .indent: - Menu(RTKL10n.menuIndent.text) { + Menu(RTKL10n.indent.text) { Group(indent: true) } case .lineSpacing: @@ -87,7 +87,7 @@ public extension RichTextCommand.FormatMenu { Group(lineSpacing: true) } case .superscript: - Menu(RTKL10n.menuSuperscript.text) { + Menu(RTKL10n.superscript.text) { Group(superscript: true) } } diff --git a/Sources/RichTextKit/Localization/RTKL10n.swift b/Sources/RichTextKit/Localization/RTKL10n.swift index 923299b4e..77ab7d8cf 100644 --- a/Sources/RichTextKit/Localization/RTKL10n.swift +++ b/Sources/RichTextKit/Localization/RTKL10n.swift @@ -17,6 +17,10 @@ public enum RTKL10n: String, CaseIterable, Identifiable { font, fontSize, + fontSizeIncrease, + fontSizeIncreaseDescription, + fontSizeDecrease, + fontSizeDecreaseDescription, color, foregroundColor, @@ -27,16 +31,8 @@ public enum RTKL10n: String, CaseIterable, Identifiable { actionCopy, actionDismissKeyboard, - actionFontSizeIncrease, - actionFontSizeDecrease, - actionIndentIncrease, - actionIndentDecrease, - actionLineSpacingIncrease, - actionLineSpacingDecrease, actionPrint, actionRedoLatestChange, - actionSuperscriptIncrease, - actionSuperscriptDecrease, actionUndoLatestChange, fileFormatRtk, @@ -44,25 +40,26 @@ public enum RTKL10n: String, CaseIterable, Identifiable { fileFormatRtf, fileFormatTxt, + indent, + indentIncrease, + indentIncreaseDescription, + indentDecrease, + indentDecreaseDescription, + lineSpacing, lineSpacingIncrease, + lineSpacingIncreaseDescription, lineSpacingDecrease, - + lineSpacingDecreaseDescription, + menuExport, menuExportAs, - menuFont, menuFormat, - menuIndent, - menuIndentIncrease, - menuIndentDecrease, menuPrint, menuSave, menuSaveAs, menuShare, menuShareAs, - menuSuperscript, - menuSuperscriptIncrease, - menuSuperscriptDecrease, menuText, highlightedRange, @@ -79,6 +76,12 @@ public enum RTKL10n: String, CaseIterable, Identifiable { styleItalic, styleStrikethrough, styleUnderlined, + + superscript, + superscriptIncrease, + superscriptIncreaseDescription, + superscriptDecrease, + superscriptDecreaseDescription, textAlignment, textAlignmentLeft, @@ -93,38 +96,38 @@ public extension RTKL10n { _ points: Int ) -> RTKL10n { points < 0 ? - .actionFontSizeDecrease : - .actionFontSizeIncrease + .fontSizeDecreaseDescription : + .fontSizeIncreaseDescription } static func actionStepIndent( _ points: Double ) -> RTKL10n { points < 0 ? - .actionIndentDecrease : - .actionIndentIncrease + .indentDecreaseDescription : + .indentIncreaseDescription } static func actionStepLineSpacing( _ points: CGFloat ) -> RTKL10n { points < 0 ? - .actionLineSpacingDecrease : - .actionLineSpacingIncrease + .lineSpacingDecreaseDescription : + .lineSpacingIncreaseDescription } static func actionStepSuperscript( _ steps: Int ) -> RTKL10n { steps < 0 ? - .actionSuperscriptDecrease : - .actionSuperscriptIncrease + .superscriptDecreaseDescription : + .superscriptIncreaseDescription } static func menuIndent(_ points: Double) -> RTKL10n { points < 0 ? - .menuIndentDecrease : - .menuIndentIncrease + .indentDecrease : + .indentIncrease } } diff --git a/Sources/RichTextKit/Resources/da.lproj/Localizable.strings b/Sources/RichTextKit/Resources/da.lproj/Localizable.strings index 8acc8ff4b..81210d2af 100644 --- a/Sources/RichTextKit/Resources/da.lproj/Localizable.strings +++ b/Sources/RichTextKit/Resources/da.lproj/Localizable.strings @@ -13,6 +13,10 @@ "font" = "Skrifttype"; "fontSize" = "Skriftstørrelse"; +"fontSizeIncrease" = "Større"; +"fontSizeIncreaseDescription" = "Øge skriftstørrelsen"; +"fontSizeDecrease" = "Mindre"; +"fontSizeDecreaseDescription" = "Mindske skriftstørrelsen"; "color" = "Farve"; "foregroundColor" = "Tekst"; @@ -23,16 +27,8 @@ "actionCopy" = "Kopiere"; "actionDismissKeyboard" = "Luk tastaturet"; -"actionFontSizeIncrease" = "Øge skriftstørrelsen"; -"actionFontSizeDecrease" = "Mindske skriftstørrelsen"; -"actionIndentIncrease" = "Øge indrag"; -"actionIndentDecrease" = "Mindske indrag"; -"actionLineSpacingIncrease" = "Øge linjeafstand"; -"actionLineSpacingDecrease" = "Mindske linjeafstand"; "actionPrint" = "Udskriv"; "actionRedoLatestChange" = "Lave om"; -"actionSuperscriptIncrease" = "Increase Superscript"; -"actionSuperscriptDecrease" = "Decrease Superscript"; "actionUndoLatestChange" = "Fortryd"; "fileFormatRtk" = "Rich Text Kit (.rtk)"; @@ -40,27 +36,26 @@ "fileFormatRtf" = "Formateret tekst (.rtf)"; "fileFormatTxt" = "Ren tekst (.txt)"; +"indent" = "Indrag"; +"indentIncrease" = "Øge"; +"indentIncreaseDescription" = "Øge indrag"; +"indentDecrease" = "Mindske"; +"indentDecreaseDescription" = "Mindske indrag"; + "lineSpacing" = "Linjeafstand"; "lineSpacingIncrease" = "Increase"; +"lineSpacingIncreaseDescription" = "Øge linjeafstand"; "lineSpacingDecrease" = "Decrease"; +"lineSpacingDecreaseDescription" = "Mindske linjeafstand"; "menuExport" = "Eksportere"; "menuExportAs" = "Eksportere som..."; -"menuFont" = "Skrifttype"; -"menuFontSizeIncrease" = "Større"; -"menuFontSizeDecrease" = "Mindre"; "menuFormat" = "Format"; -"menuIndent" = "Indrag"; -"menuIndentIncrease" = "Øge"; -"menuIndentDecrease" = "Mindske"; "menuPrint" = "Udskriv..."; "menuSave" = "Spare"; "menuSaveAs" = "Spare som..."; "menuShare" = "Del"; "menuShareAs" = "Del som..."; -"menuSuperscript" = "Baslinje"; -"menuSuperscriptIncrease" = "Øge"; -"menuSuperscriptDecrease" = "Mindske"; "menuText" = "Tekst"; "highlightedRange" = "Highlight Range"; @@ -77,6 +72,13 @@ "styleStrikethrough" = "Gennemstreget"; "styleUnderlined" = "Understregning"; +"superscript" = "Baslinje"; +"superscriptIncrease" = "Øge"; +"superscriptIncreaseDescription" = "Øge Baslinje"; +"superscriptDecrease" = "Mindske"; +"superscriptDecreaseDescription" = "Mindske Baslinje"; + + "textAlignment" = "Tekstjustering"; "textAlignmentLeft" = "Venstrejusteret"; "textAlignmentRight" = "Højrejuster"; diff --git a/Sources/RichTextKit/Resources/de.lproj/Localizable.strings b/Sources/RichTextKit/Resources/de.lproj/Localizable.strings index a654dc57c..e37ea1c41 100644 --- a/Sources/RichTextKit/Resources/de.lproj/Localizable.strings +++ b/Sources/RichTextKit/Resources/de.lproj/Localizable.strings @@ -13,6 +13,10 @@ "font" = "Schriftart"; "fontSize" = "Schriftgröße"; +"fontSizeIncrease" = "Größer"; +"fontSizeIncreaseDescription" = "Schriftgröße vergrößern"; +"fontSizeDecrease" = "Kleiner"; +"fontSizeDecreaseDescription" = "Schriftgröße verkleinern"; "color" = "Farbe"; "foregroundColor" = "Text"; @@ -23,16 +27,8 @@ "actionCopy" = "Kopieren"; "actionDismissKeyboard" = "Tastatur schließen"; -"actionFontSizeIncrease" = "Schriftgröße vergrößern"; -"actionFontSizeDecrease" = "Schriftgröße verkleinern"; -"actionIndentIncrease" = "Indent vergrößern"; -"actionIndentDecrease" = "Indent verkleinern"; -"actionLineSpacingIncrease" = "Zeilenabstand Vergrößern"; -"actionLineSpacingDecrease" = "Zeilenabstand Verkleinern"; "actionPrint" = "Drucken"; "actionRedoLatestChange" = "Rückgängig"; -"actionSuperscriptIncrease" = "Increase Superscript"; -"actionSuperscriptDecrease" = "Decrease Superscript"; "actionUndoLatestChange" = "Wiederholen"; "fileFormatRtk" = "Rich Text Kit (.rtk)"; @@ -40,27 +36,26 @@ "fileFormatRtf" = "Formatierter Text (.rtf)"; "fileFormatTxt" = "Klartext (.txt)"; +"indent" = "Indent"; +"indentIncrease" = "Vergrößern"; +"indentIncreaseDescription" = "Indent vergrößern"; +"indentDecrease" = "Verkleinern"; +"indentDecreaseDescription" = "Indent verkleinern"; + "lineSpacing" = "Zeilenabstand"; "lineSpacingIncrease" = "Vergrößern"; +"lineSpacingIncreaseDescription" = "Zeilenabstand Vergrößern"; "lineSpacingDecrease" = "Verkleinern"; +"lineSpacingDecreaseDescription" = "Zeilenabstand Verkleinern"; "menuExport" = "Exportieren"; "menuExportAs" = "Exportieren als..."; -"menuFont" = "Schriftart"; -"menuFontSizeIncrease" = "Größer"; -"menuFontSizeDecrease" = "Kleiner"; "menuFormat" = "Format"; -"menuIndent" = "Indent"; -"menuIndentIncrease" = "Vergrößern"; -"menuIndentDecrease" = "Verkleinern"; "menuPrint" = "Drucken..."; "menuSave" = "Speichern"; "menuSaveAs" = "Speichern als..."; "menuShare" = "Teilen"; "menuShareAs" = "Teilen als..."; -"menuSuperscript" = "Grundlinie"; -"menuSuperscriptIncrease" = "Øge"; -"menuSuperscriptDecrease" = "Mindske"; "menuText" = "Text"; "highlightedRange" = "Highlight Range"; @@ -77,6 +72,12 @@ "styleStrikethrough" = "Durchgestrichen"; "styleUnderlined" = "Unterstrichen"; +"superscript" = "Grundlinie"; +"superscriptIncrease" = "Øge"; +"superscriptIncreaseDescription" = "Grundlinie vergrößern"; +"superscriptDecrease" = "Mindske"; +"superscriptDecreaseDescription" = "Grundlinie verkleinern"; + "textAlignment" = "Tekstjustering"; "textAlignmentLeft" = "Linke Textausrichtung"; "textAlignmentRight" = "Rechte Textausrichtung"; diff --git a/Sources/RichTextKit/Resources/en.lproj/Localizable.strings b/Sources/RichTextKit/Resources/en.lproj/Localizable.strings index a68e8b1a2..eb09ff4fe 100644 --- a/Sources/RichTextKit/Resources/en.lproj/Localizable.strings +++ b/Sources/RichTextKit/Resources/en.lproj/Localizable.strings @@ -13,6 +13,10 @@ "font" = "Font"; "fontSize" = "Font Size"; +"fontSizeIncrease" = "Larger"; +"fontSizeIncreaseDescription" = "Larger Text"; +"fontSizeDecrease" = "Smaller"; +"fontSizeDecreaseDescription" = "Smaller Text"; "color" = "Color"; "foregroundColor" = "Text Color"; @@ -23,16 +27,8 @@ "actionCopy" = "Copy"; "actionDismissKeyboard" = "Dismiss Keyboard"; -"actionFontSizeIncrease" = "Larger Text"; -"actionFontSizeDecrease" = "Smaller Text"; -"actionIndentIncrease" = "Increase Indent"; -"actionIndentDecrease" = "Decrease Indent"; -"actionLineSpacingIncrease" = "Increase Line Spacing"; -"actionLineSpacingDecrease" = "Decrease Line Spacing"; "actionPrint" = "Print"; "actionRedoLatestChange" = "Redo"; -"actionSuperscriptIncrease" = "Increase Superscript"; -"actionSuperscriptDecrease" = "Decrease Superscript"; "actionUndoLatestChange" = "Undo"; "fileFormatRtk" = "Rich Text Kit (.rtk)"; @@ -40,27 +36,26 @@ "fileFormatRtf" = "Rich Text (.rtf)"; "fileFormatTxt" = "Plain Text (.txt)"; +"indent" = "Indent"; +"indentIncrease" = "Increase"; +"indentIncreaseDescription" = "Increase Indent"; +"indentDecrease" = "Decrease"; +"indentDecreaseDescription" = "Decrease Indent"; + "lineSpacing" = "Line Spacing"; "lineSpacingIncrease" = "Increase"; +"lineSpacingIncreaseDescription" = "Increase Line Spacing"; "lineSpacingDecrease" = "Decrease"; +"lineSpacingDecreaseDescription" = "Decrease Line Spacing"; "menuExport" = "Export"; "menuExportAs" = "Export as..."; -"menuFont" = "Font"; -"menuFontSizeIncrease" = "Larger"; -"menuFontSizeDecrease" = "Smaller"; "menuFormat" = "Format"; -"menuIndent" = "Indent"; -"menuIndentIncrease" = "Increase"; -"menuIndentDecrease" = "Decrease"; "menuPrint" = "Print..."; "menuSave" = "Save"; "menuSaveAs" = "Save as..."; "menuShare" = "Share"; "menuShareAs" = "Share as..."; -"menuSuperscript" = "Superscript"; -"menuSuperscriptIncrease" = "Increase"; -"menuSuperscriptDecrease" = "Decrease"; "menuText" = "Text"; "highlightedRange" = "Highlight Range"; @@ -77,6 +72,12 @@ "styleStrikethrough" = "Strikethrough"; "styleUnderlined" = "Underline"; +"superscript" = "Superscript"; +"superscriptIncrease" = "Increase"; +"superscriptIncreaseDescription" = "Increase Superscript"; +"superscriptDecrease" = "Decrease"; +"superscriptDecreaseDescription" = "Decrease Superscript"; + "textAlignment" = "Text Alignment"; "textAlignmentLeft" = "Left"; "textAlignmentRight" = "Right"; diff --git a/Sources/RichTextKit/Resources/nb.lproj/Localizable.strings b/Sources/RichTextKit/Resources/nb.lproj/Localizable.strings index 05c8fb879..67b383653 100644 --- a/Sources/RichTextKit/Resources/nb.lproj/Localizable.strings +++ b/Sources/RichTextKit/Resources/nb.lproj/Localizable.strings @@ -13,6 +13,10 @@ "font" = "Skrifttype"; "fontSize" = "Skriftstørrelse"; +"fontSizeIncrease" = "Større"; +"fontSizeIncreaseDescription" = "Øk skriftstørrelsen"; +"fontSizeDecrease" = "Mindre"; +"fontSizeDecreaseDescription" = "Reduser skriftstørrelsen"; "color" = "Farge"; "foregroundColor" = "Tekst"; @@ -23,16 +27,8 @@ "actionCopy" = "Kopiere"; "actionDismissKeyboard" = "Lukk tastaturet"; -"actionFontSizeIncrease" = "Øk skriftstørrelsen"; -"actionFontSizeDecrease" = "Reduser skriftstørrelsen"; -"actionIndentIncrease" = "Øk indrag"; -"actionIndentDecrease" = "Reduser indrag"; -"actionLineSpacingIncrease" = "Øk linjeavstand"; -"actionLineSpacingDecrease" = "Reduser linjeavstand"; "actionPrint" = "Skrive ut"; "actionRedoLatestChange" = "Angre"; -"actionSuperscriptIncrease" = "Øk baslinje"; -"actionSuperscriptDecrease" = "Reduser baslinje"; "actionUndoLatestChange" = "Gjøre om"; "fileFormatRtk" = "Rich Text Kit (.rtk)"; @@ -40,27 +36,26 @@ "fileFormatRtf" = "Formatert tekst (.rtf)"; "fileFormatTxt" = "Ren tekst (.txt)"; +"indent" = "Indrag"; +"indentIncrease" = "Øk"; +"indentIncreaseDescription" = "Øk indrag"; +"indentDecrease" = "Reduser"; +"indentDecreaseDescription" = "Reduser indrag"; + "lineSpacing" = "Linjeavstand"; "lineSpacingIncrease" = "Øk"; +"lineSpacingIncreaseDescription" = "Øk linjeavstand"; "lineSpacingDecrease" = "Reduser"; +"lineSpacingDecreaseDescription" = "Reduser linjeavstand"; "menuExport" = "Eksporterer"; "menuExportAs" = "Eksporterer som..."; -"menuFont" = "Skrifttype"; -"menuFontSizeIncrease" = "Større"; -"menuFontSizeDecrease" = "Mindre"; "menuFormat" = "Format"; -"menuIndent" = "Indrag"; -"menuIndentIncrease" = "Øk"; -"menuIndentDecrease" = "Reduser"; "menuPrint" = "Skrive ut..."; "menuSave" = "Lagre"; "menuSaveAs" = "Lagre som..."; "menuShare" = "Del"; "menuShareAs" = "Del som..."; -"menuSuperscript" = "Baslinje"; -"menuSuperscriptIncrease" = "Øk"; -"menuSuperscriptDecrease" = "Reduser"; "menuText" = "Tekst"; "highlightedRange" = "Highlight Range"; @@ -77,6 +72,12 @@ "styleStrikethrough" = "Gjennomstreking"; "styleUnderlined" = "Understreket"; +"superscript" = "Baslinje"; +"superscriptIncrease" = "Øk"; +"superscriptIncreaseDescription" = "Øk baslinje"; +"superscriptDecrease" = "Reduser"; +"superscriptDecreaseDescription" = "Reduser baslinje"; + "textAlignment" = "Tekstjustering"; "textAlignmentLeft" = "Venstrejustert"; "textAlignmentRight" = "Høyrejustert"; diff --git a/Sources/RichTextKit/Resources/sv.lproj/Localizable.strings b/Sources/RichTextKit/Resources/sv.lproj/Localizable.strings index 73a4c2a2d..6f9f77769 100644 --- a/Sources/RichTextKit/Resources/sv.lproj/Localizable.strings +++ b/Sources/RichTextKit/Resources/sv.lproj/Localizable.strings @@ -13,6 +13,11 @@ "font" = "Typsnitt"; "fontSize" = "Teckenstorlek"; +"fontSizeIncrease" = "Större"; +"fontSizeIncreaseDescription" = "Öka teckenstorlek"; +"fontSizeDecrease" = "Mindre"; +"fontSizeDecreaseDescription" = "Minska teckenstorlek"; + "color" = "Färg"; "foregroundColor" = "Text"; @@ -23,16 +28,8 @@ "actionCopy" = "Kopiera"; "actionDismissKeyboard" = "Stäng tangentbordet"; -"actionFontSizeIncrease" = "Öka teckenstorlek"; -"actionFontSizeDecrease" = "Minska teckenstorlek"; -"actionIndentIncrease" = "Öka indrag"; -"actionIndentDecrease" = "Minska indrag"; -"actionLineSpacingIncrease" = "Öka linjeavstånd"; -"actionLineSpacingDecrease" = "Minska linjeavstånd"; "actionPrint" = "Skriv ut"; "actionRedoLatestChange" = "Gör om"; -"actionSuperscriptIncrease" = "Öka baslinje"; -"actionSuperscriptDecrease" = "Minska baslinje"; "actionUndoLatestChange" = "Ångra"; "fileFormatRtk" = "Rich Text Kit (.rtk)"; @@ -40,27 +37,26 @@ "fileFormatRtf" = "Formaterad Text (.rtf)"; "fileFormatTxt" = "Ren Text (.txt)"; +"indent" = "Indrag"; +"indentIncrease" = "Öka"; +"indentIncreaseDescription" = "Öka indrag"; +"indentDecrease" = "Minska"; +"indentDecreaseDescription" = "Minska indrag"; + "lineSpacing" = "Radavstånd"; "lineSpacingIncrease" = "Öka"; +"lineSpacingIncreaseDescription" = "Öka linjeavstånd"; "lineSpacingDecrease" = "Minska"; +"lineSpacingDecreaseDescription" = "Minska linjeavstånd"; "menuExport" = "Exportera"; "menuExportAs" = "Exportera som..."; -"menuFont" = "Typsnitt"; -"menuFontSizeIncrease" = "Större"; -"menuFontSizeDecrease" = "Mindre"; "menuFormat" = "Format"; -"menuIndent" = "Indrag"; -"menuIndentIncrease" = "Öka"; -"menuIndentDecrease" = "Minska"; "menuPrint" = "Skriv ut..."; "menuSave" = "Spara"; "menuSaveAs" = "Spara som..."; "menuShare" = "Dela"; "menuShareAs" = "Dela som..."; -"menuSuperscript" = "Baslinje"; -"menuSuperscriptIncrease" = "Öka"; -"menuSuperscriptDecrease" = "Minska"; "menuText" = "Text"; "highlightedRange" = "Highlight Range"; @@ -77,6 +73,12 @@ "styleStrikethrough" = "Genomstrykning"; "styleUnderlined" = "Understrykning"; +"superscript" = "Baslinje"; +"superscriptIncrease" = "Öka"; +"superscriptIncreaseDescription" = "Öka baslinje"; +"superscriptDecrease" = "Minska"; +"superscriptDecreaseDescription" = "Minska baslinje"; + "textAlignment" = "Textjustering"; "textAlignmentLeft" = "Vänsterjustera"; "textAlignmentRight" = "Högerjustera";