Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions examples/icu1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ICU1 plugin example

This example shows how to configure the ICU MessageFormat v1 storage plugin in `project.inlang/settings.json` and use ICU1 messages in `messages/{locale}.json`.

## Files

- `project.inlang/settings.json` uses the ICU1 plugin and `plugin.inlang.icu-messageformat-1` config.
- `messages/en.json` and `messages/de.json` contain ICU1 `select` and `plural` messages.

## Try it

From the repo root:

```sh
npx @inlang/paraglide-js@latest compile --project ./examples/icu1/project.inlang --outdir ./examples/icu1/src/paraglide
```

(Adjust the `--outdir` if you want the generated files elsewhere.)
5 changes: 5 additions & 0 deletions examples/icu1/messages/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "{mode, select, light {Hell} dark {Dunkel} system {System} other {Unbekannt}}",
"items": "{count, plural, offset:1 =0 {keine Elemente} one {# Element} other {# Elemente}}",
"greeting": "Hallo {name}!"
}
5 changes: 5 additions & 0 deletions examples/icu1/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "{mode, select, light {Light} dark {Dark} system {System} other {Unknown}}",
"items": "{count, plural, offset:1 =0 {no items} one {# item} other {# items}}",
"greeting": "Hello {name}!"
}
15 changes: 15 additions & 0 deletions examples/icu1/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@inlang/paraglide-js-example-icu1",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"build": "paraglide-js compile --project ./project.inlang --outdir ./src/paraglide",
"clean": "rm -rf ./src/paraglide ./node_modules"
},
"devDependencies": {
"@inlang/paraglide-js": "workspace:*",
"@inlang/plugin-icu1": "^1.0.0",
"@inlang/plugin-m-function-matcher": "^2.1.0"
}
}
12 changes: 12 additions & 0 deletions examples/icu1/project.inlang/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://inlang.com/schema/project-settings",
"baseLocale": "en",
"locales": ["en", "de"],
"modules": [
"./node_modules/@inlang/plugin-icu1/dist/index.js",
"./node_modules/@inlang/plugin-m-function-matcher/dist/index.js"
],
"plugin.inlang.icu-messageformat-1": {
"pathPattern": "./messages/{locale}.json"
}
}
1 change: 1 addition & 0 deletions examples/vite/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"unused": "This is an unused message",
"Unused": "This is the second unused message with a capital U to test case sensitivity",
"non_existent_in_de": "This is a new message",
"mode": "{mode, select, light {Light} dark {Dark} system {System} other {Unknown}}",
"json_array": "[\"a\", \"b\", \"c\"]",
"json_object": "\\{\"a\": \"b\", \"c\": \"d\"\\}"
}
31 changes: 31 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading