scratch-l10n 5.0.231 → 5.0.233

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.editorconfig +9 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +53 -46
  3. package/.github/workflows/ci-cd.yml +5 -5
  4. package/.github/workflows/commitlint.yml +1 -1
  5. package/.github/workflows/daily-help-update.yml +4 -4
  6. package/.github/workflows/daily-tx-pull.yml +4 -4
  7. package/.github/workflows/signature-assistant.yml +3 -3
  8. package/.prettierignore +11 -0
  9. package/CHANGELOG.md +14 -0
  10. package/README.md +12 -12
  11. package/commitlint.config.js +3 -3
  12. package/dist/l10n.js +224 -232
  13. package/dist/l10n.js.map +1 -1
  14. package/dist/localeData.js +223 -232
  15. package/dist/localeData.js.map +1 -1
  16. package/dist/supportedLocales.js +123 -130
  17. package/dist/supportedLocales.js.map +1 -1
  18. package/eslint.config.mjs +13 -0
  19. package/lib/batch.js +10 -12
  20. package/lib/progress-logger.mjs +33 -33
  21. package/lib/transifex.js +145 -144
  22. package/lib/validate.mjs +32 -31
  23. package/package.json +7 -8
  24. package/prettier.config.mjs +3 -0
  25. package/release.config.js +13 -13
  26. package/renovate.json5 +3 -5
  27. package/scripts/build-data.mjs +33 -49
  28. package/scripts/build-i18n-src.js +29 -28
  29. package/scripts/freshdesk-api.js +129 -144
  30. package/scripts/help-utils.js +129 -139
  31. package/scripts/tx-pull-editor.mjs +54 -51
  32. package/scripts/tx-pull-help-articles.js +14 -14
  33. package/scripts/tx-pull-help-names.js +14 -14
  34. package/scripts/tx-pull-locale-articles.js +19 -19
  35. package/scripts/tx-pull-www.mjs +79 -76
  36. package/scripts/tx-push-help.mjs +87 -96
  37. package/scripts/tx-push-src.js +65 -65
  38. package/scripts/validate-extension-inputs.mjs +65 -68
  39. package/scripts/validate-translations.mjs +33 -29
  40. package/scripts/validate-www.mjs +45 -43
  41. package/src/index.mjs +4 -3
  42. package/src/locale-data.mjs +148 -150
  43. package/src/supported-locales.mjs +124 -131
package/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ rulers = 80, 118, 120
8
+ trim_trailing_whitespace = true
9
+ max_line_length = 118
@@ -15,54 +15,61 @@ There are two situations in which we create manual PRs to update translations:
15
15
 
16
16
  ### 1. Updating translations manually
17
17
 
18
- * [ ] Pull editor translations from Transifex with `> npm run pull:editor`
19
- * [ ] Pull www translations from Transifex with `> npm run pull:www`
20
- * [ ] Test the result with `> npm run test`
21
- * [ ] Confirm that you see changes to files like `editor/<resource>/<lang code>.json`
18
+ - [ ] Pull editor translations from Transifex with `> npm run pull:editor`
19
+ - [ ] Pull www translations from Transifex with `> npm run pull:www`
20
+ - [ ] Test the result with `> npm run test`
21
+ - [ ] Confirm that you see changes to files like `editor/<resource>/<lang code>.json`
22
22
 
23
23
  ### Adding a language
24
24
 
25
- * [ ] Edit `src/supported-locales.mjs`:
26
- * [ ] Add entry for the language in the `locales` const
27
- * [ ] Check if language is right-to-left. If so:
28
- * Add entry in `rtlLocales`
29
-
30
- * [ ] Check if the new language uses a country code
31
- * Check [https://www.transifex.com/explore/languages](https://www.transifex.com/explore/languages). If the language has a country code:
32
- * [ ] Edit `src/supported-locales.mjs`:
33
- * Add new entry to `localeMap`. Format is `'<W3C HTML browser locale string>': '<Transifex ICU locale string>'`
34
- * [ ] Edit `.tx/config`:
35
- * Add to the `lang_map` list. Format is `<Transifex ICU locale string>:<W3C HTML browser locale string>`
36
- * NOTE: we are moving away from using the `tx` cli; `.tx/config` will eventually be deprecated
37
-
38
- * [ ] Edit `src/index.js`:
39
- * [ ] Add 'import' line
40
- * [ ] Add entry in `localeData` array
41
-
42
- * [ ] Check if locale is in `react-intl`
43
- * Look in [https://unpkg.com/react-intl/locale-data/](https://unpkg.com/react-intl/locale-data/)
44
- * If not in `react-intl`:
45
- * [ ] Edit `src/supported-locales.mjs`:
46
- * In `customLocales`, add entry with parent set to a `react-intl` locale
47
- * [ ] Edit `src/index.js`:
48
- * In `localeData`, add entry for parent locale
49
-
50
- * [ ] Update translations per the "Updating translations" section above
51
- * [ ] Confirm that we see changes to:
52
- * [ ] `src/supported-locales.mjs`
53
- * [ ] `src/index.js`
54
- * [ ] `.tx/config` (if language needed a new locale)
55
- * [ ] Multiple files like `editor/<resource>/<lang code>.json`
56
-
57
- * [ ] Bump minor version number in `package.json`
58
-
59
- * [ ] **Add language po files to scratchr2_translations**
60
- * manually update `scratchr2_translations/legacy` with `tx pull -l <locale>` and check in changes
61
-
62
- * [ ] **Add language to scratchr2 settings**
63
- * manually update `settings/base.py` with the new language
25
+ - [ ] Edit `src/supported-locales.mjs`:
26
+
27
+ - [ ] Add entry for the language in the `locales` const
28
+ - [ ] Check if language is right-to-left. If so:
29
+ - Add entry in `rtlLocales`
30
+
31
+ - [ ] Check if the new language uses a country code
32
+
33
+ - Check [https://www.transifex.com/explore/languages](https://www.transifex.com/explore/languages). If the language has a country code:
34
+ - [ ] Edit `src/supported-locales.mjs`:
35
+ - Add new entry to `localeMap`. Format is `'<W3C HTML browser locale string>': '<Transifex ICU locale string>'`
36
+ - [ ] Edit `.tx/config`:
37
+ - Add to the `lang_map` list. Format is `<Transifex ICU locale string>:<W3C HTML browser locale string>`
38
+ - NOTE: we are moving away from using the `tx` cli; `.tx/config` will eventually be deprecated
39
+
40
+ - [ ] Edit `src/index.js`:
41
+
42
+ - [ ] Add 'import' line
43
+ - [ ] Add entry in `localeData` array
44
+
45
+ - [ ] Check if locale is in `react-intl`
46
+
47
+ - Look in [https://unpkg.com/react-intl/locale-data/](https://unpkg.com/react-intl/locale-data/)
48
+ - If not in `react-intl`:
49
+ - [ ] Edit `src/supported-locales.mjs`:
50
+ - In `customLocales`, add entry with parent set to a `react-intl` locale
51
+ - [ ] Edit `src/index.js`:
52
+ - In `localeData`, add entry for parent locale
53
+
54
+ - [ ] Update translations per the "Updating translations" section above
55
+ - [ ] Confirm that we see changes to:
56
+
57
+ - [ ] `src/supported-locales.mjs`
58
+ - [ ] `src/index.js`
59
+ - [ ] `.tx/config` (if language needed a new locale)
60
+ - [ ] Multiple files like `editor/<resource>/<lang code>.json`
61
+
62
+ - [ ] Bump minor version number in `package.json`
63
+
64
+ - [ ] **Add language po files to scratchr2_translations**
65
+
66
+ - manually update `scratchr2_translations/legacy` with `tx pull -l <locale>` and check in changes
67
+
68
+ - [ ] **Add language to scratchr2 settings**
69
+ - manually update `settings/base.py` with the new language
64
70
 
65
71
  #### After scratch-l10n update is published:
66
- * [ ] **Update scratch-blocks dependency**
67
- * [ ] in `package.json`, update the version of the scratch-l10n dependency to the version number you used above
68
- * [ ] pull translations so that a new `Blockly.ScratchMsgs.locales["<LOCALE CODE>"]` is added to `msg/scratch_msgs.js`
72
+
73
+ - [ ] **Update scratch-blocks dependency**
74
+ - [ ] in `package.json`, update the version of the scratch-l10n dependency to the version number you used above
75
+ - [ ] pull translations so that a new `Blockly.ScratchMsgs.locales["<LOCALE CODE>"]` is added to `msg/scratch_msgs.js`
@@ -7,11 +7,11 @@ on:
7
7
  workflow_run: # Allows you to run this workflow when another workflow is run
8
8
  types: [completed]
9
9
  workflows:
10
- - "Daily TX Pull"
11
- - "Daily Help Update"
10
+ - 'Daily TX Pull'
11
+ - 'Daily Help Update'
12
12
 
13
13
  concurrency:
14
- group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
14
+ group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
15
15
  cancel-in-progress: true
16
16
 
17
17
  permissions:
@@ -28,8 +28,8 @@ jobs:
28
28
 
29
29
  - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
30
30
  with:
31
- cache: "npm"
32
- node-version-file: ".nvmrc"
31
+ cache: 'npm'
32
+ node-version-file: '.nvmrc'
33
33
 
34
34
  - name: Info
35
35
  run: |
@@ -2,7 +2,7 @@ name: Lint commit messages
2
2
  on: [pull_request]
3
3
 
4
4
  concurrency:
5
- group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}"
5
+ group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}'
6
6
 
7
7
  jobs:
8
8
  commitlint:
@@ -4,10 +4,10 @@ on:
4
4
  workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
5
5
  schedule:
6
6
  # daily-help-update (e.g., daily at 5 AM UTC)
7
- - cron: "0 5 * * *"
7
+ - cron: '0 5 * * *'
8
8
 
9
9
  concurrency:
10
- group: "${{ github.workflow }}"
10
+ group: '${{ github.workflow }}'
11
11
  cancel-in-progress: true
12
12
 
13
13
  permissions:
@@ -24,8 +24,8 @@ jobs:
24
24
  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25
25
  - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
26
26
  with:
27
- cache: "npm"
28
- node-version-file: ".nvmrc"
27
+ cache: 'npm'
28
+ node-version-file: '.nvmrc'
29
29
 
30
30
  - name: Install dependencies
31
31
  run: |
@@ -4,10 +4,10 @@ on:
4
4
  workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
5
5
  schedule:
6
6
  # daily-tx-pull (e.g., daily at 3 AM UTC)
7
- - cron: "0 3 * * *"
7
+ - cron: '0 3 * * *'
8
8
 
9
9
  concurrency:
10
- group: "${{ github.workflow }}"
10
+ group: '${{ github.workflow }}'
11
11
  cancel-in-progress: true
12
12
 
13
13
  permissions:
@@ -28,8 +28,8 @@ jobs:
28
28
  - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
29
29
  - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
30
30
  with:
31
- cache: "npm"
32
- node-version-file: ".nvmrc"
31
+ cache: 'npm'
32
+ node-version-file: '.nvmrc'
33
33
 
34
34
  - name: Install dependencies
35
35
  run: npm ci
@@ -1,9 +1,9 @@
1
- name: "Signature Assistant"
1
+ name: 'Signature Assistant'
2
2
  on:
3
3
  issue_comment:
4
4
  types: [created]
5
5
  pull_request_target:
6
- types: [opened,closed,synchronize]
6
+ types: [opened, closed, synchronize]
7
7
 
8
8
  permissions:
9
9
  actions: write
@@ -15,7 +15,7 @@ jobs:
15
15
  CLA-Assistant:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - name: "CLA Assistant"
18
+ - name: 'CLA Assistant'
19
19
  if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
20
20
  uses: contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08 # v2.6.1
21
21
  env:
@@ -0,0 +1,11 @@
1
+ node_modules/
2
+ /locales/*
3
+ /dist/
4
+ /src/locale-data/*
5
+
6
+ # don't fight semantic-release
7
+ /CHANGELOG.md
8
+
9
+ # don't format JSON pulled from Transifex
10
+ /editor/*/*.json
11
+ /www/*/*.json
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.0.233](https://github.com/scratchfoundation/scratch-l10n/compare/v5.0.232...v5.0.233) (2025-05-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **deps:** lock file maintenance ([f4e122d](https://github.com/scratchfoundation/scratch-l10n/commit/f4e122d0af97ccc454d66736734b2447144e1044))
12
+
13
+ ## [5.0.232](https://github.com/scratchfoundation/scratch-l10n/compare/v5.0.231...v5.0.232) (2025-05-07)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **deps:** lock file maintenance ([1e2db4a](https://github.com/scratchfoundation/scratch-l10n/commit/1e2db4aa1b943df6bcf4eacd9050cc2e30284887))
19
+
6
20
  ## [5.0.231](https://github.com/scratchfoundation/scratch-l10n/compare/v5.0.230...v5.0.231) (2025-05-05)
7
21
 
8
22
 
package/README.md CHANGED
@@ -10,23 +10,23 @@ you would like to contribute translations, please sign up to translate on Transi
10
10
  ### Basic Use
11
11
 
12
12
  ```js
13
- import locales, {localeData, isRtl} from 'scratch-l10n';
14
- import editorMessages from 'scratch-l10n/locales/editor-messages';
13
+ import locales, { localeData, isRtl } from 'scratch-l10n'
14
+ import editorMessages from 'scratch-l10n/locales/editor-messages'
15
15
  ```
16
16
 
17
- * `locales`: currently supported locales for the Scratch project
18
- * `isRtl`: function that returns true if the locale is one that is written right-to-left
19
- * `localeData`: locale data for the supported locales, in the format accepted by `addLocaleData` required by `react-intl`
20
- * `editorMessages`: the actual message strings for all supported locales for a particular resource. `editorMessages`
17
+ - `locales`: currently supported locales for the Scratch project
18
+ - `isRtl`: function that returns true if the locale is one that is written right-to-left
19
+ - `localeData`: locale data for the supported locales, in the format accepted by `addLocaleData` required by `react-intl`
20
+ - `editorMessages`: the actual message strings for all supported locales for a particular resource. `editorMessages`
21
21
  collects all the strings for the interface, extensions and paint-editor.
22
22
 
23
23
  ### Useful Scripts
24
24
 
25
25
  scratch-l10n provides:
26
26
 
27
- * `build-i18n-src`: script that uses babel and plugins to extract all `FormattedMessage` strings for translation.
27
+ - `build-i18n-src`: script that uses babel and plugins to extract all `FormattedMessage` strings for translation.
28
28
  Combines the message from all the source files into one `en.json`
29
- * `tx-push-src`: script to push the `en.json` file to Transifex. Requires that the environment variable `TX_TOKEN` is
29
+ - `tx-push-src`: script to push the `en.json` file to Transifex. Requires that the environment variable `TX_TOKEN` is
30
30
  set with a value that has developer access to the Scratch projects on Transifex (i.e. Scratch Team only)
31
31
 
32
32
  ### Versioning
@@ -50,12 +50,12 @@ specification.
50
50
 
51
51
  Here's a quick introduction:
52
52
 
53
- * Prefix your commit subject with `fix:` if it fixes a bug but doesn't add any new functionality and doesn't change
53
+ - Prefix your commit subject with `fix:` if it fixes a bug but doesn't add any new functionality and doesn't change
54
54
  the API.
55
- * Prefix your commit subject with `feat:` if it adds new functionality but maintains backwards compatibility.
56
- * Include `BREAKING CHANGE:` as a footer in your commit body, or add `!` to the commit subject, if the change breaks
55
+ - Prefix your commit subject with `feat:` if it adds new functionality but maintains backwards compatibility.
56
+ - Include `BREAKING CHANGE:` as a footer in your commit body, or add `!` to the commit subject, if the change breaks
57
57
  compatibility with existing code.
58
- * Other prefixes, such as `chore:`, `docs:`, etc., are allowed but will not change the version or cause a new release.
58
+ - Other prefixes, such as `chore:`, `docs:`, etc., are allowed but will not change the version or cause a new release.
59
59
  These should only be used for changes that do not affect functionality.
60
60
 
61
61
  ### Example commit messages
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
- extends: ['@commitlint/config-conventional'],
3
- ignores: [message => message.startsWith('chore(release):')]
4
- };
2
+ extends: ['@commitlint/config-conventional'],
3
+ ignores: [message => message.startsWith('chore(release):')],
4
+ }