0Pricing
SwiftUI Academy · レッスン

文字列とString Catalogをローカライズする

String CatalogでUIを翻訳します。

「文字列とString Catalogをローカライズする」はCoddyKit上の無料SwiftUI Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはSwiftUI Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 SwiftUI Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Why Localize?

Localization translates your app's text so people read it in their own language. It widens your audience around the world. 🌍

Strings Are Already Keys

In SwiftUI, a Text("Hello") literal is automatically treated as a localizable key. You often get translation for free.

Text("Welcome back")

Meet the String Catalog

A modern String Catalog (.xcstrings) gathers every key in one editable table with a column per language.

Adding a Catalog

Add a String Catalog via File, New File, then build once. Xcode auto-collects the strings used across your app.

Adding Languages

In project settings, add a language under Localizations. A new column appears in the catalog, ready for translations.

Interpolating Values

Insert dynamic values right inside Text. Swift turns them into a format key so each language can place them correctly.

Text("Hi, \(name)!")

Giving Translators Context

Add a comment so translators know what a string means. The same word can be a noun or a verb.

Text("Open", comment: "Verb on a button that opens a file")

Handling Plurals

Languages pluralize differently. A String Catalog supports plural variations so "1 item" and "5 items" both read naturally.

Text("^[\(count) item](inflect: true)")

Localizing in Code

Outside a Text view, wrap user-facing strings in String(localized:) so they still get translated.

let msg = String(localized: "Saved")

Don't Hardcode Layout

Translations can be much longer than English. Let views resize instead of using fixed widths so text never gets clipped.

Test with a Pseudolanguage

Run the scheme in a pseudolanguage to expand and accent text. It surfaces clipped labels before real translation begins.

Quick Check

Which file type is the modern, recommended way to manage translations in Xcode?

Recap

You can reach a global audience: Text literals are keys, a String Catalog holds translations, and comments plus plurals keep them accurate. 🌟

よくある質問

「文字列とString Catalogをローカライズする」レッスンは無料ですか?

はい。「文字列とString Catalogをローカライズする」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、SwiftUI Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 SwiftUI Academyコースには全4レッスンが含まれています。

「文字列とString Catalogをローカライズする」で何を学びますか?

String CatalogでUIを翻訳します。 ブラウザで直接実行するハンズオンコードでSwiftUI Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

SwiftUI Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのSwiftUI Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「文字列とString Catalogをローカライズする」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このSwiftUI Academyレッスンでコードを書いて実行できますか?

はい。すべてのSwiftUI Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. VoiceOverとアクセシビリティラベル
  2. Dynamic Typeとスケーラブルフォント
  3. 文字列とString Catalogをローカライズする
  4. ライトモードとダークモードに対応する
← SwiftUI Academyに戻る