Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: l10n in HamsteriOS #452

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

dieterplex
Copy link

  • Introduce swiftgen for l10n dev
  • Extract strings of Settings view to zh-Hans / zh-Hant /en l10n files

Note: manually exec swiftgen to update the generated file

@imfuxiao
Copy link
Owner

imfuxiao commented Dec 8, 2023

您好,感谢您的PR,有些问题和个人想法。

  1. 请问为什么要跳过 spm 的校验?
  2. 个人想法:目前仓输入法的使用人群都是中文用户,所以不需要英文的国际的支持。

@dieterplex
Copy link
Author

  1. 如commit log所附參考。針對個別plug-in 的 trust file 處理上需寫入文件到CI環境也非正規處理方式。且目前只有使用SwiftGen plugin 也是知名專案,skip plugin validation 個人認為是較容易也直接無疑慮的方式。日後有更多plugin 可再做複雜處理。需要加上comment 或 todo?,或是不想引入SPM避免validation,也可預先安裝swiftgen以 Action step 處理,你認為呢?

  2. 同意,若不同意加入英文strings就移除。當初想法是參照 iMast (有CJK用戶) 的做法使用 swiftgen,之後可套用 crowdin 做l10n。非中文用戶多寡不知道多少,考慮這類用戶是少但不可能沒有,還有機會用crowdin之類的工具提高l10n質量。

@imfuxiao
Copy link
Owner

imfuxiao commented Dec 8, 2023

  1. 个人偏向使用 Action step 處理

  2. 如果要做英文的国际话支持,除了翻译正确性的问题外,还有 UI 的适配问题。如 Label 标签的显示问题,都需要做调整测试。

另外除了 App 的国际化外,键盘还需要做,感觉是个费力的活。

@dieterplex
Copy link
Author

Action step 我花些時間試試,en l10n 先不進PR,之後看是否有人幫忙低優先就是。

另外除了 App 的国际化外,键盘还需要做,感觉是个费力的活。
這裡是指鍵盤的l10n?

我不過是rime-liur*方案的繁體用戶,不會iOS開發。發現可以用倉套方案來用真是太好了☺️。看issue既多又雜辛苦你了!

@imfuxiao
Copy link
Owner

imfuxiao commented Dec 8, 2023

Action step 我花些時間試試,en l10n 先不進PR,之後看是否有人幫忙低優先就是。

另外除了 App 的国际化外,键盘还需要做,感觉是个费力的活。
這裡是指鍵盤的l10n?

我不過是rime-liur*方案的繁體用戶,不會iOS開發。發現可以用倉套方案來用真是太好了☺️。看issue既多又雜辛苦你了!

客气了,英文可以先不做,因为过长的英文,如果 UI 没做适配,显示就会有问题。当然如果您有空余时间,也可以做下英文的界面测试更好。

键盘目前来说主要是回车键显示的问题,我之前把回车键的国际化删除了,目前全部用中文简体写死了。因为键盘启动读取国际化文件会有一定的延迟,大约 5ms 左右,不过这个可以在优化后,重新在加上。

另外,对于引入 swiftgen 我有点犹豫,因为 iOS 有原生的国际化解决方案。除非是有什么原因,我建议尽量使用原生解决方案。

@dieterplex
Copy link
Author

键盘目前来说主要是回车键显示的问题,我之前把回车键的国际化删除了,目前全部用中文简体写死了。因为键盘启动读取国际化文件会有一定的延迟,大约 5ms 左右,不过这个可以在优化后,重新在加上。

如何知道使用swiftgen產生的static enum 對此有改善?

另外,对于引入 swiftgen 我有点犹豫,因为 iOS 有原生的国际化解决方案。除非是有什么原因,我建议尽量使用原生解决方案。

原生解決方案是新的 String catalog?看swiftgen的討論像是內部仍會 compile 成 strings,不確定這裡的差異是什麼。可提供些指引?

@dieterplex
Copy link
Author

dieterplex commented Jan 17, 2024

  • 參考github上現有項目,將 swfitgen 包裝為 swift package。
  • 調整 Makefile 加入 make run-swiftgen 在 Action Step 或手動叫用。以 xcrun 編譯並執行 swiftgen 作為 build tool 使用。
  • 以功能區分 commit,refactor hans strings 並 加入 hant strings
    • 使用命令 grep -r "\"[^a-z0-9#.,;/\\)\"]\+\"" --exclude-dir .build --exclude-dir .swiftpm --exclude-dir Resources --exclude-dir Generated Packages/HamsteriOS 查找字符串,似有遺漏中英夾雜的字符串。
    • 未使用代碼或示意用文字不做 L10N。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants