-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Support internationalization (#1500)
- Loading branch information
1 parent
c5b5a08
commit d42ff2a
Showing
67 changed files
with
1,244 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,7 @@ release/ | |
.awcache | ||
coverage/ | ||
*.stackdump | ||
|
||
# Ignore the english compiled file | ||
i18n/resources.en.json | ||
i18n/xliff/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/components/layout/main-navigation/main-navigation.i18n.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
main-navigation: | ||
dashboard: Dash | ||
jobs: Jobs | ||
jobschedules: Job schedules | ||
pools: Pools | ||
packages: Packages | ||
certificates: Certificates | ||
data: Data | ||
gallery: Gallery | ||
profile: Profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Injectable } from "@angular/core"; | ||
import { TranslationsLoaderService } from "@batch-flask/core"; | ||
import { remote } from "electron"; | ||
|
||
@Injectable() | ||
export class AppTranslationsLoaderService extends TranslationsLoaderService { | ||
public translations = new Map<string, string>(); | ||
|
||
constructor() { | ||
super(); | ||
const translationsLoader = (remote.getCurrentWindow() as any).translationsLoader; | ||
this.translations = new Map(JSON.parse(translationsLoader.serializedTranslations)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from "./blobStorageResult"; | ||
export * from "./sharedAccessPolicy"; | ||
export * from "./storageRequestOptions"; | ||
export * from "./blob-storage-result"; | ||
export * from "./shared-access-policy"; | ||
export * from "./storage-request-options"; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Localization in Batch Explorer | ||
|
||
To make component localizable you can use one of the following | ||
* `i18n` pipe | ||
* `I18nService` | ||
|
||
## Define key and language | ||
The translations will be automatically read from files with the `i18n.yml` extension. e.g. `[filename].i18n.yml` | ||
You'll need to restart the app if you add a new file. Just refreshing the page will update the translations. | ||
Create a file with the name `[my-component].i18n.yml` next to the `[my-component].component.ts` and other files. | ||
|
||
## Usage | ||
### `i18n` Pipe | ||
```html | ||
<div> | ||
{{'my-key.my-sub-key' | i18n}} | ||
</div> | ||
``` | ||
|
||
|
||
### I18nService | ||
```ts | ||
class MyComponent { | ||
constructor(private i18n: I18nService){ | ||
|
||
} | ||
|
||
public get title() { | ||
return this.i18n.t("my-key.sub.key", {param: "value"}); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"main-navigation.jobs": "Travaux", | ||
"main-navigation.pools": "Pools", | ||
"main-navigation.jobschedules": "Planifications" | ||
} |
Oops, something went wrong.