This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d1d71d
commit 9b20287
Showing
1 changed file
with
54 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 🌐 Koj I18N | ||
|
||
This repository contains our internationalization files, synced every hour from Google Sheets, so they're version controlled i18n files with git. On built time, our website fetches them from here. | ||
|
||
[![Update CI](https://github.com/koj-co/i18n/workflows/Update%20CI/badge.svg)](https://github.com/koj-co/i18n/actions?query=workflow%3A%22Update+CI%22) | ||
[![Trigger CI](https://github.com/koj-co/i18n/workflows/Trigger%20CI/badge.svg)](https://github.com/koj-co/i18n/actions?query=workflow%3A%22Trigger+CI%22) | ||
|
||
## ⭐ How it works | ||
|
||
Every hour, a GitHub Actions workflow generates the files in the [`./locales`](./locales) directory from a Google Sheets spreadsheet with the following layout: | ||
|
||
| key | en-ch | de-ch | | ||
| ---- | ------------- | ------------ | | ||
| key1 | Value English | Value German | | ||
|
||
In this spreadsheet, the cell `A1` should be "key", and `A2`...`A` should be language codes. | ||
|
||
The generated file [`./locales/de-ch.json`](./locales/de-ch.json), for example, would be: | ||
|
||
```json | ||
{ | ||
"key1": "Value German" | ||
} | ||
``` | ||
|
||
### Configuration | ||
|
||
The following environment variables are required: | ||
|
||
- `SHEET_ID` is the Google Sheet ID (see [How to do I locate a Google Sheets ID?](https://stackoverflow.com/a/36062068/1656944)) | ||
- `BUILD_WEBHOOK` is the webhook to call after completing the process (optional) | ||
|
||
You can also create a `.i18nrc` file in the root of your project instead, with the keys `sheetId` and `buildWebhook`: | ||
|
||
```json | ||
{ | ||
"sheetId": "example", | ||
"buildWebhook": "https://example.com/post" | ||
} | ||
``` | ||
|
||
## 👩💻 Development | ||
|
||
Run process locally: | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
## 📄 License | ||
|
||
The code in this repository, with the exception of the `locales` folder, are licensed under [MIT](./LICENSE.MIT). | ||
|
||
The contents of the `locales` folder are licensed under [CC-BY-4.0](./LICENSE.CC). |