Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Adding new languages: Part 1 #1882

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,24 @@ Setting for Languages (i18n) still under development
MIFOS_DEFAULT_LANGUAGE=en-US
```
```
MIFOS_SUPPORTED_LANGUAGES=en-US,fr-FR
```
MIFOS_SUPPORTED_LANGUAGES=cs-CS,de-DE,en-US,es-MX,fr-FR,it-IT,ko-KO,lt-LT,lv-LV,ne-NE,pt-PT,sw-SW
```
These are the Language available now:

| Language | Code | File |
|:----------:|:----:|:----------:|
| Czech | cs | cs-CS.json |
| German | de | de-DE.json |
| English | en | en-US.json |
| Spanish | es | es-MX.json |
| French | fr | fr-FR.json |
| Italian | it | it-IT.json |
| Korean | ko | ko-KO.json |
| Lithuanian | li | li-LI.json |
| Latvian | lv | lv-LV.json |
| Nepali | ne | ne-NE.json |
| Portuguese | pt | pt-PT.json |
| Swahili | sw | sw-SW.json |


Setting for applying the Client preload in the Clients view, Default true
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ services:
- FINERACT_API_VERSION=/v1
- FINERACT_PLATFORM_TENANT_IDENTIFIER=default
- MIFOS_DEFAULT_LANGUAGE=en-US
- MIFOS_SUPPORTED_LANGUAGES=cs-CS,de-DE,en-US,es-MX,fr-FR,it-IT,ko-KO,lt-LT,lv-LV,ne-NE,pt-PT
- MIFOS_SUPPORTED_LANGUAGES=cs-CS,de-DE,en-US,es-MX,fr-FR,it-IT,ko-KO,lt-LT,lv-LV,ne-NE,pt-PT,sw-SW
44 changes: 26 additions & 18 deletions docs/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Use the `translate` directive on an HTML element to automatically translate its

You can also use the `translate` pipe if needed:
```html
<button title="{{ 'Add item' | translate }}">+</button>
<button title="{{'Add item' | translate}}">+</button>
```

### In TypeScript code
Expand All @@ -26,28 +26,36 @@ let title;
translateService.get('My page title').subscribe((res: string) => { title = res; });
```

or `TranslateService` dependency and use the asynchronous
`instant()` method:

```typescript
const title: string = translateService.instant('My page title');
```

## Extracting strings to translate

Once you are ready to translate your app, just run `npm translations:extract`.
It will create a `template.json` file in the `src/translations` folder.
It will create a `template.json` file in the `src/assets/translations` folder.

You can then use any text or code editor to generate the `.json` files for each of your supported languages, and put
them in the `src/translations` folder.
them in the `src/assets/translations` folder.

Do no forget to edit the files in `src/environment` to add the supported languages of your application.

### Marking strings for extraction

If strings are not directly passed to `translateService` or put in HTML templates, they may be missing from the
extraction process.

For these cases, you have to use the dummy `extract()` function:
```typescript
import { extract } from './core/i18n.service';

function toBeTranslatedLater() {
return extract('A string to be translated');
}
```

Strings marked like this will then be properly extracted.
These are the Language available now:

| Language | Code | File |
|:----------:|:----:|:----------:|
| Czech | cs | cs-CS.json |
| German | de | de-DE.json |
| English | en | en-US.json |
| Spanish | es | es-MX.json |
| French | fr | fr-FR.json |
| Italian | it | it-IT.json |
| Korean | ko | ko-KO.json |
| Lithuanian | li | li-LI.json |
| Latvian | lv | lv-LV.json |
| Nepali | ne | ne-NE.json |
| Portuguese | pt | pt-PT.json |
| Swahili | sw | sw-SW.json |
Loading