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
2026 Begins: Choosing to Stay on the Path as a Blogger
By
Errong Leng
-
Today is January 1st, 2026 . Before rushing into new goals, I spent some time looking back at the past 12 months of data for this blog — the quiet numbers that tell a very honest story. Looking Back at the Numbers Over the past year: 📈 Total views: ~44,600 👀 Daily average visits: ~200 💬 Comments: 19 💰 AdSense income: about $0.01 per month At first glance, these numbers may look small — especially the income. But when I zoom out, I see something more meaningful. This blog has been quietly read every single day . No viral posts. No aggressive promotion. No paid traffic. Just consistent readers arriving through search, bookmarks, and curiosity. That consistency matters. What the Traffic Graph Tells Me The graph over the last 12 months shows something important: Early months were quiet and uneven Mid-year brought steady growth Toward the end of the year, traffic became more stable , with clear spikes when certain posts resonated This tell...
Cross compile tensorflow for armv7l targets via bazel
By
三好Daddy
-
Health Checks and Scaling Strategies for Next.js in Kubernetes
By
Errong Leng
-
Health Checks and Scaling Strategies for Next.js in Kubernetes This is Part 6 and the final post of the series: Self-Hosting Next.js in Kubernetes (Without Vercel) . At this point, your Next.js standalone app: Builds cleanly Runs in a minimal Docker image Deploys correctly on Kubernetes / OpenShift Serves static assets properly Uses runtime configuration and secrets Now let’s make it resilient and scalable . Why Health Checks Matter Kubernetes relies on health checks to: Know when a pod is ready to receive traffic Restart unhealthy containers Safely roll out new versions Without proper probes, traffic can be sent to a pod that isn’t ready yet. Readiness Probe A readiness probe tells Kubernetes: “This pod can accept traffic.” For most Next.js apps, the root path works well: readinessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 10 periodSeconds: 5 If your app depends on downstream services (APIs, d...
Comments
Post a Comment