Skip to content

Commit

Permalink
Add localization for RichTextActions
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikBucher12 committed Jan 19, 2024
1 parent a32fb8e commit 78a3967
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
37 changes: 23 additions & 14 deletions Sources/RichTextKit/Actions/RichTextAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,29 @@ public extension RichTextAction {
case .stepSuperscript(let steps): .actionStepSuperscript(steps)
case .toggleStyle(let style): style.titleKey
case .undoLatestChange: .actionUndoLatestChange
case .backgroundColor: RTKL10n(rawValue: "1")!
case .foregroundColor: RTKL10n(rawValue: "1")!
case .underlineColor: RTKL10n(rawValue: "1")!
case .strikethroughColor: RTKL10n(rawValue: "1")!
case .strokeColor: RTKL10n(rawValue: "1")!
case .highlightedRange: RTKL10n(rawValue: "1")!
case .highlightingStyle: RTKL10n(rawValue: "1")!
case .pasteImage: RTKL10n(rawValue: "1")!
case .pasteImages: RTKL10n(rawValue: "1")!
case .pasteText: RTKL10n(rawValue: "1")!
case .selectRange: RTKL10n(rawValue: "1")!
case .setAttributedString: RTKL10n(rawValue: "1")!
case .changeStyle:
RTKL10n(rawValue: "1")!
case .backgroundColor: .backgroundColor
case .foregroundColor: .foregroundColor
case .underlineColor: .underlineColor
case .strikethroughColor: .strikethroughColor
case .strokeColor: .strokeColor
case .highlightedRange: .highlightedRange
case .highlightingStyle: .highlightingStyle
case .pasteImage: .pasteImage
case .pasteImages: .pasteImages
case .pasteText: .pasteText
case .selectRange: .selectRange
case .setAttributedString: .setAttributedString
case .changeStyle(let style, _):
switch style {
case .bold:
.styleBold
case .italic:
.styleItalic
case .underlined:
.styleUnderlined
case .strikethrough:
.styleStrikethrough
}
}
}
}
Expand Down
17 changes: 15 additions & 2 deletions Sources/RichTextKit/Localization/RTKL10n.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public enum RTKL10n: String, CaseIterable, Identifiable {
color,
foregroundColor,
backgroundColor,

underlineColor,
strikethroughColor,
strokeColor,

actionCopy,
actionDismissKeyboard,
actionFontSizeIncrease,
Expand Down Expand Up @@ -52,7 +55,17 @@ public enum RTKL10n: String, CaseIterable, Identifiable {
menuShare,
menuShareAs,
menuText,


highlightedRange,
highlightingStyle,

pasteImage,
pasteImages,
pasteText,
selectRange,

setAttributedString,

styleBold,
styleItalic,
styleStrikethrough,
Expand Down
12 changes: 12 additions & 0 deletions Sources/RichTextKit/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"color" = "Color";
"foregroundColor" = "Text Color";
"backgroundColor" = "Background";
"underlineColor" = "Underline Color";
"strikethroughColor" = "Striketrough Color";
"strokeColor" = "Stroke Color";

"actionCopy" = "Copy";
"actionDismissKeyboard" = "Dismiss Keyboard";
Expand Down Expand Up @@ -50,6 +53,15 @@
"menuSuperscriptDecrease" = "Subscript";
"menuText" = "Text";

"highlightedRange" = "Highlight Range";
"highlightingStyle" = "Highlighting Style";

"pasteImage" = "Paste Image";
"pasteImages" = "Paste Images";
"pasteText" = "Paste text";
"selectRange" = "Select Range";
"setAttributedString" = "Set attributed String";

"styleBold" = "Bold";
"styleItalic" = "Italic";
"styleStrikethrough" = "Strikethrough";
Expand Down

0 comments on commit 78a3967

Please sign in to comment.