|
1 | 1 | # @inlang/paraglide-js |
2 | 2 |
|
| 3 | +## 2.4.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 7791be7: Upgraded the [inlang SDK](https://github.com/opral/inlang-sdk) to [Lix](https://lix.dev/) v0.5 🎉 |
| 8 | + |
| 9 | + ## Highlights |
| 10 | + |
| 11 | + ### Writing directly to Lix state |
| 12 | + |
| 13 | + State is now written straight into Lix instead of the SDK’s private in-memory SQLite snapshot. Every bundle, message, and variant change becomes a first-class Lix commit, unlocking: |
| 14 | + |
| 15 | + - history and branching, |
| 16 | + - writer-key aware workflows, |
| 17 | + - change proposals and subscriptions, and |
| 18 | + - a single source of truth for downstream tools. |
| 19 | + |
| 20 | + ### Per-file filesystem sync |
| 21 | + |
| 22 | + Any inlang-based tooling that opens a project from disk (IDE extensions, CLIs, custom apps) used to patch the entire locale tree whenever a single message changed. That behaviour is at the heart of [opral/inlang-sherlock#173](https://github.com/opral/inlang-sherlock/issues/173) where editing one key in `en.json` would re-export every other locale file, destroying manual formatting or reintroducing stale content. |
| 23 | + |
| 24 | + Thanks to Lix v0.5’s observable state and writer-key APIs we can now react to per-commit metadata and suppress our own writes. When `happy_elephant` in `en.json` is updated, the SDK marks only `en.json` as dirty, leaving `de.json` and friends untouched. Drift is still possible if another tool rewrites `en.json`, yet the blast radius falls from “the whole project just changed” to “only the file you touched,” making reviews and merges manageable across all inlang integrations. |
| 25 | + |
| 26 | +### Patch Changes |
| 27 | + |
| 28 | +- 4a48c07: fix: fix eslint incorrectly linting generated files |
| 29 | + |
| 30 | + closes https://github.com/opral/inlang-paraglide-js/issues/558 |
| 31 | + |
| 32 | + eslint ignores single-line 'eslint-disable' comments at the start of a file. |
| 33 | + Using a block comment without a closing one instead will prompt eslint to ignore it. |
| 34 | + |
| 35 | + ```diff |
| 36 | + - output[filename] = `// eslint-disable\n${content}`; |
| 37 | + + output[filename] = `/* eslint-disable */\n${content}`; |
| 38 | + ``` |
| 39 | + |
| 40 | +- 4c8921f: Fixes `overwriteSetLocale` to keep the full `(locale, options?)` signature when overriding `setLocale`, preventing TypeScript from rejecting calls that pass `{ reload: false }`. Adds a regression test ensuring custom handlers receive the options object. |
| 41 | +- Updated dependencies [7791be7] |
| 42 | + - @inlang/sdk@3.0.0 |
| 43 | + |
3 | 44 | ## 2.3.2 |
4 | 45 |
|
5 | 46 | ### Patch Changes |
|
28 | 69 | This change introduces a new `extractLocaleFromRequestAsync` function that supports asynchronous custom server strategies, enabling use cases like fetching user locale preferences from databases. |
29 | 70 |
|
30 | 71 | ## What's Changed |
| 72 | + |
31 | 73 | - **New Function**: Added `extractLocaleFromRequestAsync` that supports async custom server strategies |
32 | 74 | - **Middleware Update**: Server middleware now uses the async version to support async custom strategies |
33 | 75 | - **Breaking Change**: The synchronous `extractLocaleFromRequest` no longer supports custom server strategies |
|
96 | 138 | ``` |
97 | 139 |
|
98 | 140 | **Migration**: |
| 141 | + |
99 | 142 | - If you want the previous behavior (subdomain sharing), explicitly set `cookieDomain` in your configuration: |
100 | 143 |
|
101 | 144 | ```diff |
|
113 | 156 | - 4255bd5: Provide functions for getting the preferred language on server and client. |
114 | 157 |
|
115 | 158 | This defines two new functions for getting the preferred language: |
| 159 | + |
116 | 160 | - `extractLocaleFromHeader`: Extracts the locale from the accept-language header on the server. |
117 | 161 | - `extractLocaleFromNavigator`: Extracts the locale from the navigator.languages array on the client. |
118 | 162 |
|
|
124 | 168 | This introduces a new way to define custom locale resolution strategies alongside built-in strategies. Custom strategies provide a cleaner, more composable approach compared to overwriting `getLocale()` and `setLocale()` functions directly. |
125 | 169 |
|
126 | 170 | **New APIs:** |
| 171 | + |
127 | 172 | - `defineCustomClientStrategy()`: Define custom strategies for client-side locale resolution |
128 | 173 | - `defineCustomServerStrategy()`: Define custom strategies for server-side locale resolution |
129 | 174 |
|
130 | 175 | **Key features:** |
| 176 | + |
131 | 177 | - Custom strategies must follow the pattern `custom-<name>` where `<name>` contains only alphanumeric characters |
132 | 178 | - Can be combined with built-in strategies in the strategy array |
133 | 179 | - Respect strategy order for fallback handling |
|
250 | 296 | - 698b9a9: add `cookieMaxAge` option to compiler and runtime |
251 | 297 |
|
252 | 298 | Closes https://github.com/opral/inlang-paraglide-js/issues/483 |
| 299 | +
|
253 | 300 | - Introduced `cookieMaxAge` option to `CompilerOptions`, allowing configuration of cookie expiration time. |
254 | 301 | - Adjusted tests to verify `max-age` in cookies. |
255 | 302 |
|
@@ -968,6 +1015,7 @@ await compile({ |
968 | 1015 | - 14d80b3: Removed the "Which tech-stack are you using?" prompt from the `init` command as it was not providing any real value. All it did was link you to the appropriate documentation. |
969 | 1016 |
|
970 | 1017 | From now on we rely on the docuemntation site to guide people to the correct documenation for their framework. |
| 1018 | +
|
971 | 1019 | - SvelteKit: https://inlang.com/m/dxnzrydw/paraglide-sveltekit-i18n |
972 | 1020 | - NextJs: https://inlang.com/m/osslbuzt/paraglide-next-i18n |
973 | 1021 | - Astro: https://inlang.com/m/iljlwzfs/paraglide-astro-i18n |
|
0 commit comments