Skip to content

Commit

Permalink
feat: Improve text localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyingtao committed Sep 26, 2024
1 parent 17d14f9 commit 9ea353d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Sources/SwiftUIFontSettingsView/FontSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ public struct FontSettingsView<ExtraTopContent: View, ExtraBottomContent: View>:
} else {
Picker(NSLocalizedString("fontSettings.textStyle", bundle: .module, comment: ""), selection: $fontSettings.textStyle) {
ForEach(Font.TextStyle.allTextStyles, id: \.self) { style in
Text(NSLocalizedString(style.description, bundle: .module, comment: ""))
Text(NSLocalizedString("textStyle." + style.description.lowercased(), bundle: .module, comment: ""))
}
}

Picker(NSLocalizedString("fontSettings.fontWeight", bundle: .module, comment: ""), selection: $fontSettings.fontWeight) {
ForEach(Font.Weight.allWeights, id: \.self) { weight in
Text(NSLocalizedString(weight.description, bundle: .module, comment: ""))
Text(NSLocalizedString("fontWeight." + weight.description.lowercased(), bundle: .module, comment: ""))
}
}

Picker(NSLocalizedString("fontSettings.fontDesign", bundle: .module, comment: ""), selection: $fontSettings.fontDesign) {
ForEach(Font.Design.allDesigns, id: \.self) { design in
Text(NSLocalizedString(design.description, bundle: .module, comment: ""))
Text(NSLocalizedString("fontDesign." + design.description.lowercased(), bundle: .module, comment: ""))
.fontDesign(design)
}
}
Expand All @@ -150,7 +150,7 @@ public struct FontSettingsView<ExtraTopContent: View, ExtraBottomContent: View>:
if !fontSettings.useCustomFont || fontSettings.useCustomFont && fontSettings.customFontNames.isEmpty {
Picker(NSLocalizedString("fontSettings.fontWidth", bundle: .module, comment: ""), selection: $fontSettings.fontWidth) {
ForEach(Font.Width.allWidths, id: \.self) { width in
Text(NSLocalizedString(width.description, bundle: .module, comment: ""))
Text(NSLocalizedString("fontWidth." + width.description.lowercased(), bundle: .module, comment: ""))
}
}
}
Expand Down
23 changes: 21 additions & 2 deletions Sources/SwiftUIFontSettingsView/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fontSettings.fontDesign" = "Font Design";

// Font Weight Options
"fontWeight.ultraLight" = "Ultra Light";
"fontWeight.ultra light" = "Ultra Light";
"fontWeight.thin" = "Thin";
"fontWeight.light" = "Light";
"fontWeight.regular" = "Regular";
Expand Down Expand Up @@ -43,4 +43,23 @@
"fontSettings.fontName" = "Font Name";
"fontSettings.textStyle" = "Text Style";
"fontSettings.fontWidth" = "Font Width";
"fontSettings.fontSize" = "Font Size: %d";
"fontSettings.fontSize" = "Font Size: %d";

// New Text Style localizations
"textStyle.large title" = "Large Title";
"textStyle.title" = "Title";
"textStyle.title2" = "Title 2";
"textStyle.title3" = "Title 3";
"textStyle.headline" = "Headline";
"textStyle.subheadline" = "Subheadline";
"textStyle.body" = "Body";
"textStyle.callout" = "Callout";
"textStyle.footnote" = "Footnote";
"textStyle.caption" = "Caption";
"textStyle.caption2" = "Caption 2";

// New Font Width localizations
"fontWidth.compressed" = "Compressed";
"fontWidth.condensed" = "Condensed";
"fontWidth.standard" = "Standard";
"fontWidth.expanded" = "Expanded";
23 changes: 21 additions & 2 deletions Sources/SwiftUIFontSettingsView/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fontSettings.fontDesign" = "フォントデザイン";

// Font Weight Options
"fontWeight.ultraLight" = "極細";
"fontWeight.ultra light" = "極細";
"fontWeight.thin" = "細";
"fontWeight.light" = "軽";
"fontWeight.regular" = "標準";
Expand Down Expand Up @@ -43,4 +43,23 @@
"fontSettings.fontName" = "フォント名";
"fontSettings.textStyle" = "テキストスタイル";
"fontSettings.fontWidth" = "フォントの幅";
"fontSettings.fontSize" = "フォントサイズ:%d";
"fontSettings.fontSize" = "フォントサイズ:%d";

// New Text Style localizations
"textStyle.large title" = "ラージタイトル";
"textStyle.title" = "タイトル";
"textStyle.title2" = "タイトル2";
"textStyle.title3" = "タイトル3";
"textStyle.headline" = "見出し";
"textStyle.subheadline" = "サブ見出し";
"textStyle.body" = "本文";
"textStyle.callout" = "コールアウト";
"textStyle.footnote" = "脚注";
"textStyle.caption" = "キャプション";
"textStyle.caption2" = "キャプション2";

// New Font Width localizations
"fontWidth.compressed" = "圧縮";
"fontWidth.condensed" = "凝縮";
"fontWidth.standard" = "標準";
"fontWidth.expanded" = "拡張";
23 changes: 21 additions & 2 deletions Sources/SwiftUIFontSettingsView/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fontSettings.fontDesign" = "字体设计";

// Font Weight Options
"fontWeight.ultraLight" = "极细";
"fontWeight.ultra light" = "极细";
"fontWeight.thin" = "纤细";
"fontWeight.light" = "细体";
"fontWeight.regular" = "常规";
Expand Down Expand Up @@ -43,4 +43,23 @@
"fontSettings.fontName" = "字体名称";
"fontSettings.textStyle" = "文本样式";
"fontSettings.fontWidth" = "字体宽度";
"fontSettings.fontSize" = "字体大小:%d";
"fontSettings.fontSize" = "字体大小:%d";

// New Text Style localizations
"textStyle.large title" = "大标题";
"textStyle.title" = "标题";
"textStyle.title2" = "标题2";
"textStyle.title3" = "标题3";
"textStyle.headline" = "头条";
"textStyle.subheadline" = "副标题";
"textStyle.body" = "正文";
"textStyle.callout" = "引用";
"textStyle.footnote" = "脚注";
"textStyle.caption" = "说明";
"textStyle.caption2" = "说明2";

// New Font Width localizations
"fontWidth.compressed" = "压缩";
"fontWidth.condensed" = "紧缩";
"fontWidth.standard" = "标准";
"fontWidth.expanded" = "扩展";

0 comments on commit 9ea353d

Please sign in to comment.