@dialpad/i18n 1.25.7 → 1.27.0
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.
- package/docs/README.md +49 -12
- package/package.json +2 -2
package/docs/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
This package contains all the logic needed to handle i18n for a Dialpad
|
|
8
8
|
application extending from the common logic existing in the base locale manager
|
|
9
9
|
that you can find about on the
|
|
10
|
-
[i18n-services documentation](../../i18n-services/docs/README.md),
|
|
11
|
-
different bundle sources.
|
|
10
|
+
[i18n-goblin-services documentation](../../i18n-goblin-services/docs/README.md),
|
|
11
|
+
based on different bundle sources.
|
|
12
12
|
|
|
13
13
|
## How it works
|
|
14
14
|
|
|
@@ -696,17 +696,55 @@ Each screenshot should contain visual information of where the translation can
|
|
|
696
696
|
be found in the app with enough context to be easily located. If other dev looks
|
|
697
697
|
at the screenshot they should be able to locate it fairly easily in your app.
|
|
698
698
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
699
|
+
By default each translation key needs its own `{translationKey}.png`. When
|
|
700
|
+
several keys share a view (e.g. a modal) you can point them at a single
|
|
701
|
+
screenshot instead of duplicating it — either inline with the `@screenshot:`
|
|
702
|
+
marker (`# @screenshot: modal.png` per key, or a block
|
|
703
|
+
`## @screenshot: modal.png` group comment that scopes every following key until
|
|
704
|
+
the next `##`), or via the config `groups` below. The marker value is a bare
|
|
705
|
+
filename in the sibling `context-screenshots/` dir (extension optional). We only
|
|
706
|
+
support `.png` images for now.
|
|
704
707
|
|
|
705
708
|
There is a PR check which will fail if any translation key is missing its
|
|
706
|
-
corresponding screenshot.
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
709
|
+
corresponding screenshot. Keys and paths can be opted out through three
|
|
710
|
+
mechanisms (any one is sufficient — they are additive, with no precedence):
|
|
711
|
+
|
|
712
|
+
**1. Inline comment marker** — add `# @i18n-screenshot-ignore` directly above a
|
|
713
|
+
message (no blank line, space after `#` required), or a block
|
|
714
|
+
`## @i18n-screenshot-ignore` group comment to opt out every key that follows it
|
|
715
|
+
until the next `##`:
|
|
716
|
+
|
|
717
|
+
```fluent
|
|
718
|
+
# @i18n-screenshot-ignore
|
|
719
|
+
my-dynamic-key = Some value that changes at runtime
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
**2. Co-located config file** — create an optional `i18n-screenshots.config`
|
|
723
|
+
sibling to your `.ftl` file (absence is fine, never fails the check). It can be
|
|
724
|
+
JSON or a `.js`/`.ts` module (default export):
|
|
725
|
+
|
|
726
|
+
```jsonc
|
|
727
|
+
// i18n-screenshots.config.json
|
|
728
|
+
{
|
|
729
|
+
"excludeKeys": ["my-dynamic-key"], // exact key names to skip
|
|
730
|
+
"excludePaths": ["legacy/**"], // globs relative to this dir to skip wholesale
|
|
731
|
+
"groups": { "modal.png": ["modal-title", "modal-save"] }, // share one screenshot
|
|
732
|
+
}
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
```ts
|
|
736
|
+
// i18n-screenshots.config.ts — same shape, loaded via Node type-stripping
|
|
737
|
+
export default {
|
|
738
|
+
groups: { 'modal.png': ['modal-title', 'modal-save'] },
|
|
739
|
+
};
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
Inline `@screenshot:` markers take priority over config `groups` for the same
|
|
743
|
+
key.
|
|
744
|
+
|
|
745
|
+
**3. Built-in exception list** — a hardcoded list in the shared package covers
|
|
746
|
+
projects that were already excluded before the config existed. Avoid adding to
|
|
747
|
+
it; use a co-located config in your app repo instead.
|
|
710
748
|
|
|
711
749
|
These screenshots will be located in a directory called `context-screenshots`
|
|
712
750
|
sibling to each `.ftl` file in your project. If you have an `.ftl` file, it
|
|
@@ -722,4 +760,3 @@ github action when a PR to main is merged.
|
|
|
722
760
|
- [I18n best practices](https://localization.blog/2022/05/16/i18n-best-practices-keep-it-together/)
|
|
723
761
|
- [i18n-goblin-core docs](../../i18n-goblin-core/docs/README.md)
|
|
724
762
|
- [i18n-goblin-services docs](../../i18n-goblin-services/docs/README.md)
|
|
725
|
-
- [i18n-services docs (deprecated)](../../i18n-services/docs/README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialpad/i18n",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Internationalization library for Vue 3 apps using Mozilla's Fluent syntax, with locale management, translation bundle loading, and CLI tools for translation workflows",
|
|
6
6
|
"keywords": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@dialpad/i18n-goblin-core": "1.2.1",
|
|
26
|
-
"@dialpad/i18n-goblin-services": "1.
|
|
26
|
+
"@dialpad/i18n-goblin-services": "1.6.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@vitejs/plugin-vue": "~6.0.5",
|