Skip to content

Commit 54d58e6

Browse files
JanCizmarstepan662
andauthored
feat: Apple Strings Catalog support added (blog + docs) (#841)
Co-authored-by: Štěpán Granát <[email protected]>
1 parent eb60aa0 commit 54d58e6

File tree

6 files changed

+152
-4
lines changed

6 files changed

+152
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
slug: 2025-02-05-apple-xcstrings-import-export
3+
title: 'Tolgee now Supports Apple String Catalog (.xcstrings)'
4+
description: 'Tolgee now supports importing and exporting localization data in the Apple String Catalog (.xcstrings) format.'
5+
image: '/img/blog/apple-xcstrings-support/apple-light.webp'
6+
authors: [jcizmar]
7+
tags: ['tolgee', 'apple', 'xcstrings', 'localization', 'format']
8+
---
9+
10+
import ThemedImage from '@theme/ThemedImage';
11+
import useBaseUrl from '@docusaurus/useBaseUrl';
12+
13+
<ThemedImage
14+
alt="Apple String Catalog Support Blog Image"
15+
sources={{
16+
light: useBaseUrl(
17+
'/img/blog/apple-xcstrings-support/apple-xcstrings-light.webp'
18+
),
19+
dark: useBaseUrl(
20+
'/img/blog/apple-xcstrings-support/apple-xcstrings-dark.webp'
21+
),
22+
}}
23+
/>
24+
25+
We’re excited to share that Tolgee now supports the [Apple String Catalog (.xcstrings) format](/platform/formats/apple_xcstrings), a modern localization format for Apple platforms.
26+
27+
<!--truncate-->
28+
29+
This means you can now import and export your localization files in the .xcstrings format, streamlining your workflow for iOS, macOS, and other Apple ecosystem apps.
30+
31+
Apple String Catalog (.xcstrings) is a structured JSON-based format that improves localization handling with features like pluralization and rich metadata. With Tolgee’s support, you can now manage your localized strings seamlessly.
32+
33+
Whether you’re developing apps for iPhone, iPad, macOS, or any Apple platform, simply upload your .xcstrings files to Tolgee, make your edits, and export them back—ready for use in your Xcode projects.
34+
35+
Try it out and let us know what you think! Your feedback helps us improve. Happy localizing!

platform/formats/apple_xcstrings.mdx

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
id: apple_xcstrings
3+
title: Apple String Catalog (.xcstrings)
4+
sidebar_label: Apple String Catalog
5+
---
6+
7+
Apple String Catalog is the latest Apple approach to localization for Apple platforms.
8+
We recommend using it in favor of XLIFF since this format gives you
9+
better control over the strings and their translations.
10+
11+
Tolgee supports simple values as well as plural values.
12+
13+
Example of a Stringsdict file:
14+
```json
15+
{
16+
"sourceLanguage": "en",
17+
"version": "1.0",
18+
"strings": {
19+
"dog_count": {
20+
"localizations": {
21+
"en": {
22+
"variations": {
23+
"plural": {
24+
"other": {
25+
"stringUnit": {
26+
"state": "translated",
27+
"value": "I have %lld dogs."
28+
}
29+
}
30+
}
31+
}
32+
},
33+
"cs": {
34+
"variations": {
35+
"plural": {
36+
"one": {
37+
"stringUnit": {
38+
"state": "translated",
39+
"value": "Já mám jednoho psa."
40+
}
41+
},
42+
"few": {
43+
"stringUnit": {
44+
"state": "translated",
45+
"value": "Já mám %lld psi."
46+
}
47+
},
48+
"other": {
49+
"stringUnit": {
50+
"state": "translated",
51+
"value": "Já mám %lld psů."
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}
58+
},
59+
"hello": {
60+
"en": {
61+
"stringUnit": {
62+
"state": "translated",
63+
"value": "Hello!"
64+
}
65+
},
66+
"localizations": {
67+
"cs": {
68+
"stringUnit": {
69+
"state": "translated",
70+
"value": "Ahoj!"
71+
}
72+
}
73+
}
74+
}
75+
}
76+
}
77+
```
78+
79+
We recommend using the semantic keys format as in the examples above. That enables you to change the base values without
80+
modifying the key and doesn't suggest keeping the keys in sync with the base language translation.
81+
82+
import ApplePlaceholders from './components/_apple_placeholders.mdx';
83+
84+
<ApplePlaceholders />
85+
86+
import Importing from './components/_general_importing.mdx';
87+
88+
<Importing />
89+
90+
# Using with the CLI
91+
92+
Apple String Catalog (.xcstrings) format differs slightly from other formats because it contains all the languages in a single file.
93+
94+
You will probably want to push only the base language (usually English) since translating other languages will happen in the Tolgee Platform. That's why we set the `push.languages` to `["en"]`, so Tolgee will ignore all other languages included in the `.xcstrings`.
95+
96+
For pulling, you usually want to use all the languages from the Tolgee platform, so we are keeping the default for the `pull` option.
97+
98+
```json
99+
{
100+
"$schema": "https://docs.tolgee.io/cli-schema.json",
101+
"projectId": 123, // project id in tolgee platform
102+
"format": "APPLE_XCSTRINGS",
103+
"push": {
104+
"filesTemplate": "./i18n/Localizable.xcstrings",
105+
"languages": ["en"] // which languages should be pushed by default
106+
},
107+
"pull": {
108+
"path": "./i18n"
109+
}
110+
}
111+
```
112+
113+
> Read [more about CLI](/tolgee-cli)

sidebarPlatform.js

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module.exports = {
6969
'formats/csv',
7070
'formats/xlsx',
7171
'formats/apple_strings',
72+
'formats/apple_xcstrings',
7273
'formats/apple_xliff',
7374
'formats/android_xml',
7475
'formats/compose_multiplatform_xml',
Binary file not shown.
Binary file not shown.

tolgee-cli/project-configuration.mdx

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ Example configuration:
1010
```json
1111
{
1212
"$schema": "https://docs.tolgee.io/cli-schema.json",
13-
"projectId": 123,
13+
"projectId": 123, // project id in tolgee platform
1414
"format": "JSON_TOLGEE",
15-
"patterns": ["./src/**/*.ts?(x)"],
15+
"patterns": ["./src/**/*.ts?(x)"], // pattern for code extraction
1616
"push": {
1717
"filesTemplate": "./public/i18n/{languageTag}.json",
18-
"language": ["en"],
19-
"forceMode": "OVERRIDE",
18+
"language": ["en"], // which languages should be pushed by default
2019
},
2120
"pull": {
2221
"path": "./public/i18n"

0 commit comments

Comments
 (0)