Skip to content

Commit

Permalink
docs: documentation adjustments (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless authored Apr 19, 2022
1 parent b9ff6cb commit c3251bd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .vscode/intershop.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ setuprequest
ruleset
rulesets
unpatched
pluralizable

foo
foos
Expand Down
11 changes: 11 additions & 0 deletions docs/concepts/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,21 @@ export class Component {
<div>{{ 'product.items.label' | translate:{'0': param} }}</div>
```
---
### Localization with Pluralization
The PWA uses an [ICU Message Format](https://unicode-org.github.io/icu/userguide/format_parse/messages/) inspired way of supporting pluralization in translation keys.
In addition to using pluralization for specific numbers, the Intershop PWA supports the following [pluralization cases](https://unicode-org.github.io/cldr-staging/charts/latest/supplemental/language_plural_rules.html): `zero`, `one`, `two`, `few`, `many` and `other`.
You can use these cases in your pluralizable translation definitions like this:
```json
"shopping_cart.ministatus.items.text": "{{0, plural, one{# item} other{# items}}}",
```
Refer to [this explanation](https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html) if you want to learn more about pluralization rules and why they are necessary for inclusive, multi-language applications.
Have a look at the spec for [PWATranslateCompiler](../../src/app/core/utils/translate/pwa-translate-compiler.spec.ts) for an overview of supported methods.
> :warning: Translations with large values (> 1000 characters) will not be compiled to improve performance. We recommend using CMS components instead. If you _really_ need to increase this limit, adapt the `MAX_COMPILATION_LENGTH` variable of [PWATranslateCompiler](../../src/app/core/utils/translate/pwa-translate-compiler.ts).
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/eslint.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ The custom rules are developed separately from the main source code, which uses

To work with and develop new custom ESLint rules, follow these steps:

1. Generate a new rule using our schematic: `ng g eslint-rule` (alias `er`). This generates a new rule file at `eslint-rules/src/rules`, a test file at `eslint-rules/tests` and adds the rule to `index.ts`. `index.ts` exports the rules to be consumed in the `.eslintrc.json` configuration file.
1. Generate a new rule using our schematic: `ng g eslint-rule` (alias `er`). This generates a new rule file at `eslint-rules/src/rules` and a test file at `eslint-rules/tests`.
2. Write the rule code. Refer to [Working with Rules](https://eslint.org/docs/developer-guide/working-with-rules) as well as examples from available rules to understand how. Add reusable helper functions to `helpers.ts` to reduce repetition.
3. Write rule tests. Refer to [Testing](https://typescript-eslint.io/docs/development/custom-rules#testing) for documentation on the `RuleTester` API that is used in tests. Use `npm run test:eslint-rules` to execute your tests - under the hood, this runs the [`_execute-tests.ts`](../../eslint-rules/tests/_execute-tests.ts) script.
4. Build the `eslint-rules` project with your changes using `npm run build:eslint-rules`. The resulting JavaScript files will be located in the `eslint-rules/dist` folder.
3. Write rule tests. Refer to [Testing](https://typescript-eslint.io/docs/development/custom-rules#testing) for documentation on the `RuleTester` API that is used in tests. Use `npm run test:eslint-rules` to execute your tests.
4. Build the `eslint-rules` project with your changes using `npm run build:eslint-rules`. The resulting JavaScript files will be located in the `eslint-rules/dist` folder. A generated `index.ts` exports the rules to be consumed in the `.eslintrc.json` configuration file.
5. Add the new rule to the ESLint configuration in [`.eslintrc.json`](../../.eslintrc.json).
6. _Optional_: Restart the ESLint server using the `ESLint: Restart ESLint server` command to see your new configuration applied in VSCode. You can access the command via the editor commands (default keybinding: `ctrl + shift + p`).

0 comments on commit c3251bd

Please sign in to comment.