Skip to content

Commit

Permalink
doc: add translations new command
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Feb 6, 2025
1 parent b060c8f commit b070d01
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
22 changes: 18 additions & 4 deletions docs/3-Templates.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
description: "Working with layouts, templates and components."
date: 2021-05-07
updated: 2025-01-23
updated: 2025-02-06
alias: documentation/layouts
-->
# Templates
Expand Down Expand Up @@ -1252,6 +1252,8 @@ Pluralize:
Translation files must be named `messages.<locale>.<format>` and stored in the [`translations`](4-Configuration.md#translations) directory.
Cecil supports `yaml` and `mo` (Gettext) file [formats by default](4-Configuration.md#translations).

The locale code (e.g.: `fr_FR`) of a language is defined in the [`languages`](4-Configuration.md#languages) entries of the configuration.

_Example:_

```plaintext
Expand All @@ -1262,15 +1264,27 @@ _Example:_
```

:::info
The locale code (e.g.: `fr_FR`) of a language is defined in the [`languages`](4-Configuration.md#languages) entries of the configuration.
You can easyly extract translations from your templates with the following command:

```bash
php cecil.phar util:translations:extract
```

:::

:::tip
[_Poedit Pro_](https://poedit.net/pro) is recommended to easily translate your templates.
[_Poedit_](https://poedit.net) is a simple and cross platform translation editor for gettext (PO), and [_Poedit Pro_](https://poedit.net/pro) supports extraction of translation strings from templates out of the box.
:::

:::important
Be carreful about the cache ([enabled by default](4-Configuration.md#cache)) when you update translations files. Cache can be cleared with with the following command: `php cecil.phar cache:clear:translations`.
Be carreful about the cache ([enabled by default](4-Configuration.md#cache)) when you update translations files.

Cache can be cleared with with the following command:

```bash
php cecil.phar cache:clear:translations`
```

:::

### Date localization
Expand Down
3 changes: 2 additions & 1 deletion docs/5-Commands.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
description: "List of available commands."
date: 2020-12-19
updated: 2024-01-30
updated: 2025-02-06
-->
# Commands

Expand All @@ -28,6 +28,7 @@ Available commands:
show:content Shows content as tree
util
util:templates:extract Extracts built-in templates
util:translations:extract Extracts translations from layouts
```

## new:site
Expand Down

0 comments on commit b070d01

Please sign in to comment.