You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6902dfd
Browse filesBrowse the repository at this point in the historyBrowse files
description: Use Blockstudio in your language and help translate it.
4
+
path: 'general/translations'
5
+
order: 3
6
+
section: "Start"
7
+
subsection: 'Setup'
8
+
meta_title: 'Translations'
9
+
meta_description: 'Use Blockstudio in your language and help translate it.'
10
+
---
11
+
12
+
# Translations
13
+
14
+
Blockstudio ships its translations in the `languages` folder. WordPress uses them whenever the site language, or the language in a user profile, matches one of them. This works the same way when Blockstudio runs as a plugin, a must-use plugin, or a Composer package.
15
+
16
+
## Available languages
17
+
18
+
| Language | Locale |
19
+
| --- | --- |
20
+
| German |`de_DE`|
21
+
| German (formal) |`de_DE_formal`|
22
+
23
+
The translations cover the field controls in the block editor, the admin page, the canvas, the devtools overlay, and the messages of the REST endpoints. Labels and help texts in your own `block.json` files belong to your theme or plugin and use its text domain.
24
+
25
+
## Override a translation
26
+
27
+
Translation files in `wp-content/languages/plugins` take precedence over the bundled ones, for the PHP strings (`blockstudio-de_DE.mo` or `blockstudio-de_DE.l10n.php`) as well as for the scripts (one file per script handle, for example `blockstudio-de_DE-blockstudio-blocks.json`).
28
+
29
+
## Contribute a translation
30
+
31
+
Every language is a `.po` file that you can edit with any text editor or with a translation tool such as Poedit. Corrections and new languages are welcome as pull requests.
32
+
33
+
1. To add a language, copy `languages/blockstudio.pot` to `languages/blockstudio-<locale>.po`, for example `blockstudio-fr_FR.po`, and set the `Language` and `Plural-Forms` headers. To improve a language, edit its existing `.po` file.
34
+
2. Translate the strings. Keep placeholders such as `%1$s` in the translation.
35
+
3. Run `npm run i18n`. It writes the `.mo`, `.l10n.php`, and `.json` files that WordPress loads.
36
+
4. Commit the `.po` file together with the generated files and open a pull request.
37
+
38
+
If you cannot run `npm`, a pull request with the `.po` file alone is fine. The generated files can be added before the merge.
39
+
40
+
## Translatable strings in the code
41
+
42
+
- PHP: use the WordPress functions with the `blockstudio` text domain, for example `__( 'Invalid block.', 'blockstudio' )`.
43
+
- JavaScript: import `__` from `@/utils/__` and pass a literal string, for example `__( 'Add row' )`. A string that is assembled at runtime cannot be translated, so use one literal string per variant.
44
+
- A new script bundle with translatable strings needs an entry in `scripts/i18n.ts` and a call to `wp_set_script_translations()` with the same handle and `Translations::script_path()`.
45
+
46
+
After changing strings, run `npm run i18n`. It updates `languages/blockstudio.pot` and every `.po` file. New strings stay in English until a translator fills them in. `npm run check` runs `npm run i18n:check`, which fails when the translation files are out of date or a string cannot be extracted.
Copy file name to clipboardExpand all lines: docs/guides/field-patterns.md
+6-34Lines changed: 6 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -479,42 +479,14 @@ When a condition inside a repeater needs to check a field outside the repeater,
479
479
480
480
Without `"context": "main"`, the condition would look for a `showDescriptions` field inside the repeater row. With it, the condition checks the root-level toggle.
481
481
482
-
### Repeater with tabs inside
482
+
### Tabs inside repeaters
483
483
484
-
Tabs work inside repeaters to organize complex row content:
484
+
Tabs are not available inside repeaters: a `tabs` field inside a repeater row renders an empty row. Keep the fields of a row flat instead. For long rows, a custom row label (`textMinimized`) keeps collapsed rows readable, and conditions inside the row can hide fields that only some rows need, as shown in the patterns above.
0 commit comments