Skip to content

Commit

Permalink
chore: update auto check (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Nov 28, 2024
1 parent a8fd389 commit 573996e
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ coverage.html
dist/
.task/

src/i18n/out/en-US/active.en-GB.json
locale/i18n/out/en-US/active.en-GB.json
test/data/research/scientist/

.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"--fast"
],
"cSpell.words": [
"astrolib",
"bodyclose",
"cmds",
"cobrass",
Expand Down Expand Up @@ -57,6 +58,7 @@
"staticcheck",
"structcheck",
"stylecheck",
"taskfile",
"thelper",
"toplevel",
"tparallel",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ Of course, its up to the user what settings they use in their repo, these are ju

### 🌐 l10n Translations

This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __src/i18n/deploy/arcadia.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app.
This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __locale/i18n/deploy/arcadia.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app.

Make sure that the go-i18n package has been installed so that it can be invoked as cli, see [go-i18n](https://github.com/nicksnyder/go-i18n) for installation instructions.

To maintain localisation of the application, the user must take care to implement all steps to ensure translate-ability of all user facing messages. Whenever there is a need to add/change user facing messages including error messages, to maintain this state, the user must:

+ define template struct (__xxxTemplData__) in __src/i18n/messages.go__ and corresponding __Message()__ method. All messages are defined here in the same location, simplifying the message extraction process as all extractable strings occur at the same place. Please see [go-i18n](https://github.com/nicksnyder/go-i18n) for all translation/pluralisation options and other regional sensitive content.
+ define template struct (__xxxTemplData__) in __locale/i18n/messages.go__ and corresponding __Message()__ method. All messages are defined here in the same location, simplifying the message extraction process as all extractable strings occur at the same place. Please see [go-i18n](https://github.com/nicksnyder/go-i18n) for all translation/pluralisation options and other regional sensitive content.

For more detailed workflow instructions relating to i18n, please see [i18n README](./resources/doc/i18n-README.md)

Expand Down
6 changes: 3 additions & 3 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dotenv: [".env"]
vars:
FORMAT: json
BINARY_NAME: arcadia
DEPLOY_DIR: ./src/i18n/deploy
OUT_DIR: ./src/i18n/out
DEPLOY_DIR: ./locale/i18n/deploy
OUT_DIR: ./locale/i18n/out
DIST_DIR: ./dist
#
SOURCE_LANG: en-GB
Expand Down Expand Up @@ -261,7 +261,7 @@ tasks:
# with the new translations. Also, need to copy the default
# file (active.en-GB.json) back into ./i18n/default
#
# creates ./src/i18n/out/en-US/translate.en-US.json: this is the
# creates ./locale/i18n/out/en-US/translate.en-US.json: this is the
# file to be translated. This contains hashes and also contains
# all messages, not just the ones added.
# It is useful to keep all the out file also checked in because, what we
Expand Down
16 changes: 8 additions & 8 deletions resources/doc/i18n-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ The local directory structure is as follows:

__goi18n__ instructs the user to manually create an empty translation message file that they want to add (eg `translate.en-US.json`). This is taken care of by the __newt__ task. Then the requirement is to run the goi18n merge \<active\> command (goi18n merge `arcadia.active.en-US.json` `arcadia.translate.en-US.json`). This has been wrapped up into the __merge__ task and the result is that the translation file `arcadia.translation.en-US.json` is populated with the messages to be translated. So the sequence goes:

- run __newt__ task: (generates default language file `./src/i18n/out/active.en-GB.json` and empty `./src/i18n/out/us-US/arcadia.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___)
- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./src/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./src/i18n/out/us-US/arcadia.translation.en-US.json`), both of which were generated in the previous step.
- run __newt__ task: (generates default language file `./locale/i18n/out/active.en-GB.json` and empty `./locale/i18n/out/us-US/arcadia.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___)
- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./locale/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./locale/i18n/out/us-US/arcadia.translation.en-US.json`), both of which were generated in the previous step.
- hand the translate file to your translator for them to translate
- rename the translate file to the active equivalent (`arcadia.translation.en-US.json`). Save this into the __deploy__ folder. This file will be deployed with the application.

Expand Down Expand Up @@ -56,17 +56,17 @@ Inputs:

Outputs:

- ./src/i18n/out/active.en-GB.json (messages extracted from code, without hashes)
- ./src/i18n/out/en-US/translate.en-US.json (empty)
- ./locale/i18n/out/active.en-GB.json (messages extracted from code, without hashes)
- ./locale/i18n/out/en-US/translate.en-US.json (empty)

### 💠 merge

Inputs:

- ./src/i18n/out/active.en-GB.json
- ./src/i18n/out/en-US/arcadia.translate-en-US.json
- ./locale/i18n/out/active.en-GB.json
- ./locale/i18n/out/en-US/arcadia.translate-en-US.json

Outputs:

- ./src/i18n/out/active.en-US.json
- ./src/i18n/out/translate.en-US.json
- ./locale/i18n/out/active.en-US.json
- ./locale/i18n/out/translate.en-US.json
Loading

0 comments on commit 573996e

Please sign in to comment.