-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from samvera-labs/173-i18n-internationalization
i18n Internationalization starter setup
- Loading branch information
Showing
27 changed files
with
2,697 additions
and
2,278 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
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,75 @@ | ||
--- | ||
title: i18n | ||
--- | ||
|
||
# i18n | ||
|
||
We welcome contributions to Clover IIIF in any language. If you would like to contribute to a language, please follow the instructions below. | ||
|
||
```json filename="src/i18n/locales/en.json" | ||
{ | ||
"commonClose": "Close", | ||
"commonNext": "Next", | ||
"commonPrevious": "Previous", | ||
"commonSearch": "Search", | ||
"commonSearchPlaceholder": "Search...", | ||
"commonShare": "Share", | ||
"commonViewAll": "View All", | ||
... | ||
} | ||
``` | ||
|
||
## How to contribute | ||
|
||
1. Fork the [Clover IIIF](https://github.com/samvera-labs/clover-iiif) repository. | ||
2. Create a new file in the `src/i18n/locales` directory for the relative BCP 47 language code you would like to contribute towards, example `fr.json` for French. | ||
3. Copy the `en.json` file as a template and translate the string values for each key. | ||
4. Import the new language JSON file within the `src/i18n/locales/index.ts` file and include it in the default export. | ||
5. Submit a pull request. | ||
|
||
### Adding a new locale | ||
|
||
Add a new file in the `src/i18n/locales` directory with the relative BCP 47 language code, example `fr.json` for French. | ||
|
||
```json filename="src/i18n/locales/fr.json" | ||
{ | ||
"commonClose": "Fermer", | ||
"commonNext": "Suivant", | ||
"commonPrevious": "Précédent", | ||
"commonSearch": "Rechercher", | ||
"commonSearchPlaceholder": "Rechercher...", | ||
"commonShare": "Partager", | ||
"commonViewAll": "Voir Tout", | ||
... | ||
} | ||
``` | ||
|
||
```ts filename="src/i18n/locales/index.ts" | ||
import en from "./en.json"; | ||
import fr from "./fr.json"; | ||
|
||
export default { | ||
en, | ||
fr, | ||
}; | ||
``` | ||
|
||
### Language and Region subtags | ||
|
||
If you would like to contribute a locale for a lanugage with a region subtag, | ||
please use the `-` dash character to separate the language and region in the filename, | ||
example `fr-CA.json` for Canadian French. | ||
|
||
You will need to adjust the import statement in the `src/i18n/locales/index.ts` file to include the new locale. | ||
|
||
```ts filename="src/i18n/locales/index.ts" | ||
import en from "./en.json"; | ||
import fr from "./fr.json"; | ||
import frCA from "./fr-CA.json"; | ||
|
||
export default { | ||
en, | ||
fr, | ||
"fr-CA": frCA, | ||
}; | ||
``` |
Oops, something went wrong.