I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...
我们如何为 macOS 应用添加国际化和多语言支持
- Get link
- X
- Other Apps
By
Errong Leng
-
我们如何为 macOS 应用添加国际化和多语言支持
支持多语言对于拓展全球用户至关重要。本文将以我们的 macOS 应用 iTrans 为例,介绍我们如何通过 Swift 和 Xcode 实现国际化(i18n)和中文本地化。
1. 审查所有用户可见文本
第一步是查找代码中所有用户可见的字符串。我们在 SwiftUI 视图、模型和操作符中搜索所有硬编码文本。
2. 提取待本地化字符串
我们将所有硬编码字符串替换为支持本地化的 API:
- 在 SwiftUI 中,
Text视图使用LocalizedStringKey。 - 其他字符串使用
NSLocalizedString。
Text(LocalizedStringKey("Unlock your iPhone"))
// 或
NSLocalizedString("Untitled", comment: "File with no name")
3. 创建本地化文件
我们为每种支持的语言创建了 Localizable.strings 文件:
en.lproj/Localizable.strings—— 英文zh-Hans.lproj/Localizable.strings—— 简体中文
英文示例:
"Unlock your iPhone" = "Unlock your iPhone";
中文示例:
"Unlock your iPhone" = "解锁你的 iPhone";
4. 将本地化文件添加到 Xcode 工程
为了让 Xcode 识别本地化文件:
- 我们通过项目导航器将
Localizable.strings文件添加到工程。 - 在文件检查器中,启用本地化并勾选所有支持的语言。
5. 测试本地化效果
Xcode 让我们可以轻松测试不同语言下的应用效果:
- 在 Scheme 编辑器中,将应用语言设置为“简体中文”并运行应用。
- 我们还验证了所有界面文本在英文和中文下都能正确显示。
6. 效果展示
通过以上步骤,我们的应用现已完整支持英文和中文。所有用户可见文本都已本地化,用户切换语言体验流畅。
结论:
在 Swift 和 Xcode 中实现国际化非常直接。只需遵循最佳实践:提取所有用户可见文本、使用本地化 API、为每种语言维护 .strings 文件并充分测试。这样你的应用就能面向全球用户。
❤️ Support This Blog
If this post helped you, you can support my writing with a small donation. Thank you for reading.
Popular Posts
Recommend GC log analyzer tool : GCPlot & GCeasy
By
三好Daddy
-
GCPlot Install Docker Installation You can run GCPlot in a Docker container. In order to run GCPlot as-is without additional configuration, run next command: docker run -d -p 8080:80 gcplot/gcplot After that eventually the platform will be accessible from your host machine at http://127.0.0.1:8080 address. Upload GC log JVM arguments -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause -XX:+PrintHeapAtGC -XX:+PrintAdaptiveSizePolicy -XX:+UnlockDiagnosticVMOptions -XX:+G1SummarizeRSetStats -XX:G1SummarizeRSetStatsPeriod=1 -Xloggc:/var/output/logs/garbagecollector.log -XX:+UseG1GC Analysis Groups Universal GC Log Analyzer https://gceasy.io/ It is more powerful than GCPlot, but you have to upload you GC logs to their backend and pay to see the analysis report. GCPlot is free and open source Fork from github https://it.gcplot.com/
A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android
By
Errong Leng
-
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...
How to Prepare App Preview Videos and Screenshots for App Store Connect
By
Errong Leng
-
How to Prepare App Preview Videos and Screenshots for App Store Connect When distributing your app through App Store Connect, preparing screenshots and app preview videos is one of the final — and surprisingly tricky — steps. This guide walks you through a simple, practical workflow that actually works. 📸 Screenshots (Easy Part) Screenshots are straightforward: Launch your app on your iPhone Capture screenshots directly on the device Transfer them to your Mac via AirDrop Open them in Preview and resize to the required dimensions That’s it. No special tools needed. 🎬 App Preview Videos (The Tricky Part) App preview videos have strict requirements from Apple: Key Requirements ⏱ Duration: ≤ 30 seconds 🎞 Frame rate: ≤ 30 fps (recommended: 30 fps) 📐 Resolution: 886 × 1920 (portrait) 1920 × 886 (landscape) 🔊 Must include audio 📱 Step 1: Record Your App on iPhone Use the built-in screen recording feature: Add Screen Recording to Control Center (i...
Comments
Post a Comment