Skip to content

Commit

Permalink
[DOC] Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
georgringer committed Sep 6, 2022
1 parent 283d32e commit c0a89f2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 92 deletions.
126 changes: 36 additions & 90 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,59 @@
# TYPO3 Extension `crowdin`

Integration of crowdin into TYPO3 with the following features:

- Inplace editing
- Fill Crowdin with all translation provided by the translation server
- Package translations to follow the structure required by TYPO3 sites

## Install

Install this extension + `akeneo/crowdin-api` (dev-master)

## Usage

### Crowdin In-Context Localization
This extensions integrates the inplace editing of Crowdin into TYPO3.
Using this features makes it fast and simple to add translations of XLF files used in the backend.

![In-Context Localization](Resources/Public/Screenshots/crowdin-inline-localization.png)

To enable in-context localization: Switch your user to Language *Crowdin In-Context Localization*

## API-Reference / Commands

### Convert XML to XLF

```
# Arguments: file name
./bin/typo3 crowdin:convertXml2Xlf ./path-to-a-xml-file.xml
```

### Set API Key

The API key is added to the registry, so it must only be set once.

```
# Arguments: project-identifier api-key
./bin/typo3 crowdin:setApiCredentials typo3-cms 123456
```

By using the following command you can switch between projects without readding the API key again
**Important:** This extensions can **not** be used to translate content but "static" translations saved in `xlf` files.

```
# Arguments: project-identifier
./bin/typo3 crowdin:switchApiCredentials another-project
```
## 1. Install

### Extract core translations + upload to Crowdin
### Using composer

This command will download translations from translation server and upload those to Crowdin
1. `composer req georgringer/crowdin`.
2. `./typo3cms crowdin:enable`

Instead of a single extension name, also `'*'` can be used!
### Non composer

```
# Arguments: extension-key language version
./bin/typo3 crowdin:downloadPootleCoreTranslation about de 9
```
1. Download the extension from TER
2. `./typo3/sysext/core/bin/typo3 crowdin:enable`

### Extract extension translations + upload to Crowdin
### Additional information

This command will download translations from translation server and upload those to Crowdin
The enable command writes the following information to `LocalConfiguration.php`:

```php
$GLOBALS['TYPO3_CONF_VARS']
['SYS']['localization']['locales']['user']['t3'] = 'Crowdin In-Context Localization';
['SYS']['fluid']['namespaces'] => [
'f' => [
'TYPO3\\CMS\\Fluid\\ViewHelpers',
'TYPO3Fluid\\Fluid\\ViewHelpers',
'GeorgRinger\\Crowdin\\ViewHelpers\\Override',
],
],
];
```
# Arguments: extension-key language
./bin/typo3 crowdin:downloadPootleExtTranslation news de
```

### Download languages from Crowdin

Download language packs from Crowdin and create single zip packages

```
# Arguments: language branch copyToL10n
./bin/typo3 crowdin:downloadCrowdinTranslations de master 0
```
## Usage

### Status
Follow the next steps to be able to use Crowdin in the backend:

Get translation status
1. Switch to *Install Tool* => *Maintenance* => **Manage Language Packs**
2. Click **+ Add language** and select **Crowdin In-Context Localization [t3]**, click **Update all**.
3. Switch to the **User settings**
3. Select *Crowdin In-Context Localization*.
4. Click save button.

```bash
./bin/typo3 crowdin:status
```
After the automatic reload, a Crowdin will be shown to login with your Crowdin account and to select the language you want to translate to.

Result
```
------------------------------- --------------
name Progress (%)
------------------------------- --------------
Croatian - hr 69
Czech - cs 22
Danish - da 94
Dutch - nl 82
French - fr 50 / 49
German - de 92
Greek - el 5
Hindi - hi 50
Italian - it 46
Japanese - ja 8
Khmer - km 40
Portuguese, Brazilian - pt-BR 0
Russian - ru 75
Spanish - es-ES 0
Thai - th 43
------------------------------- --------------
```
To enable in-context localization: Switch your user to Language *Crowdin In-Context Localization*

### Cleanup
## Extension Configuration

Cleanup the temporary files
This extensions can be configured in the Install Tool using *Settings* => *Extension Configuration* => *Crowdin*.

```
./bin/typo3 crowdin:clean
```
- `Enable to translate TYPO3 core`: Enable this checkbox to translate TYPO3 and its system extensions.
- `Extension key`: If the checkbox above is **NOT** set, an extension key can be provided which can be translated. A full list of available extensions on Crowdin is available at [localize.typo3.org/xliff/status.html](https://localize.typo3.org/xliff/status.html). e.g. `news`.

4 changes: 2 additions & 2 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# cat=basic/enable/100; type=boolean; label=Inline translation project identifier
# cat=basic/enable/100; type=boolean; label=Enable to translate TYPO3 core
core = 1

# cat=basic/enable/101; type=input; label=Alternative extension key
# cat=basic/enable/101; type=input; label=Extension key:If above setting is NOT set, provide an extension key supported by Crowdin: See https://localize.typo3.org/xliff/status.html for a full list.
extensionKey = news

0 comments on commit c0a89f2

Please sign in to comment.