wuchale
0.25.6
Section titled “0.25.6”Patch Changes
Section titled “Patch Changes”- c46696a: Fix new mixed visitor visiting ignored elements when nested #408
- 40b5c42: Fix runtime not initialized inside funcs with only patterns without messages
0.25.5
Section titled “0.25.5”Patch Changes
Section titled “Patch Changes”- b6372c2: Fix runtime not initialized error on messages inside hoisted function calls at the top #404
0.25.4
Section titled “0.25.4”Patch Changes
Section titled “Patch Changes”- d4ef202: Fix inconsistent handling of nested messages with non-nestable block types #402
0.25.3
Section titled “0.25.3”Patch Changes
Section titled “Patch Changes”- fa12c12: Limit nesting to only element-like nodes to fix unexpected errors (e.g. around
{#if})
0.25.2
Section titled “0.25.2”Patch Changes
Section titled “Patch Changes”- 2d436dc: Fix nested messages applying unnecessary edits #398
0.25.1
Section titled “0.25.1”Patch Changes
Section titled “Patch Changes”- a8db752: Fix
undefinedshown in nested messages #395 #396
0.25.0
Section titled “0.25.0”Minor Changes
Section titled “Minor Changes”-
Redo nested message visit algorithm (#393)
This release is all about the core of wuchale, i.e. the nested message visitor. It has now been vastly improved with a more solid approach.
0.24.2
Section titled “0.24.2”Patch Changes
Section titled “Patch Changes”-
Fix repeated messages when grouping locales for AI translate (
ff749d6) -
Fix long build times caused by wuchale #391 (
d4682fa)
0.24.1
Section titled “0.24.1”Patch Changes
Section titled “Patch Changes”- Fix Vite build error when using granular group patterns with multiple adapters (
b3d54ef)
0.24.0
Section titled “0.24.0”Minor Changes
Section titled “Minor Changes”-
Include placeholders in nested messages also indicating nesting like
0.0.1(2005ea1) -
⚠️ BREAKING: Replace
outDirconfig on adapters with CLI flag--modify(89b650b)If you want to write the transformed files back to disk, you can specify the flag in the CLI,
npx wuchale --modify {adapter1},{adapter2},...and the files for those adapters will be modified in-place. This OVERWRITES the files, therefore only use it when you are certain, and have Git already setup and in a clean state, so that you can restore them. Normally you should use it only to when you use an unsupported bundler and in that case you should only run it in CI just before deployment. Or you can use it for debugging (and restore with Git.) -
Add
propertyin heuristic details and use it to detect URLs from property names if it’shref,urlorlink(94ce7fc) -
Extract template literals that start with a placeholder expression followed by natural language content. (#381)
Messages like
{0} was successfully deleted!were previously ignored because the first character{is not a letter. They are now extracted when the leading placeholder is followed by spaces and letters. -
⚠️ BREAKING: proxies now export
loadCountinstead ofloadIDsafter #355 (f903655)The default loaders have been updated to match but if you use
loadLocalesin SvelteKit hooks or Astro middlewares, you should update them like:await loadLocales(main.key, main.loadIDs, main.loadCatalog, locales)await loadLocales(main.key, main.loadCount, main.loadCatalog, locales) -
⚠️ BREAKING: Composable storage:
dirconfig inpofileandjsonstorage changed tolocation,separateUrlsremoved. (#382)The
dirconfig which was used to set the directory under which to save catalog storages is now replaced bylocationwhich gives more control. Inpofileit should be a file path pattern with{locale}as a placeholder. If you useseparateUrls(which wastrueby default), you should now use the newstorageByTypelayer:import { pofile } from 'wuchale'import { pofile, storageByType } from 'wuchale'export default {// ...adapters: {main: svelte({// ...storage: pofile({dir: 'src/locales'}),storage: storageByType({message: pofile({location: 'src/locales/{locale}.po'}),url: pofile({location: 'src/locales/{locale}.url.po'})}),}),}}storageByTypereturns a storage itself, but if you don’t need to separate the items, you can opt not to use it. But it also opens the possibility of storing URL translations in another format for example. -
Update default Gemini model to 3.5 flash (
589fbca) -
⚠️ BREAKING: Rename config
hmrtodevwith the following options to control behavior during dev: (#377)false: Same behavior as the previoushmr: false'read': Only uses existing translations and doesn’t add newly detected messages during dev'add': Adds newly detected messages and updates their refs as they get referenced, but doesn’t touch existing messages'refs': Same behavior as the previoushmr: true, adds new messages, updates refs and marks obsoletes'clean': Full behavior same asnpx wuchale --clean, deletes unused messages
-
⚠️ BREAKING: Built-in URL matcher (#363)
A small purpose-built no-RegExp URL matcher is now included and the glob-like syntax it accepts is different from/simpler than that of
path-to-regexp.*for required segments like/foo-*matches/foo-bar?for optional segments like/foo/?matches/fooand/foo/bar**for nested like/foo/**matches/foo,/foo/barand/foo/1/bar
If you use URL patterns, you have to adjust your config accordingly:
export default {// ...adapters: {main: svelte({// ...url: {// ...patterns: ['foo/*rest','foo/**',]},}),}} -
⚠️ BREAKING: reorganize loading config, use glob patterns and number load IDs (#355)
granularLoadis nowloading.granularbundleLoadis nowloading.directgenerateLoadIDis replaced by a glob config atloading.group
Therefore if you use any of these, update your config like this:
import { defineConfig, defaultGenerateLoadID, pofile } from "wuchale"import { defineConfig, pofile } from "wuchale"import { adapter as svelte } from '@wuchale/svelte'export default defineConfig({// ...adapters: {main: svelte({// ...bundleLoad: true,granularLoad: true,generateLoadID: filename => {if (filename.includes('grouped')) {return 'grouped'}return defaultGenerateLoadID(filename)},loading: {granular: true,direct: true,group: ['**/*grouped*',]}}),}})
Patch Changes
Section titled “Patch Changes”-
Fix
filesadapter config not respected when it’s a bare string (3567c7f) -
Use the same fallback chains for URL translations (
2521033)
0.23.4
Section titled “0.23.4”Patch Changes
Section titled “Patch Changes”- Extract strings in
export constin Astro frontmatter only if they are inside functions and init runtime inside to prevent errors #372 (500616b)
0.23.3
Section titled “0.23.3”Patch Changes
Section titled “Patch Changes”- Fix TS satisfies expressions not visited (
cc89f6e)
0.23.2
Section titled “0.23.2”Patch Changes
Section titled “Patch Changes”-
Make adapter conflicts CLI warnings instead of throwing an error (
e6e62d4) -
Fix wrong files config caused by config merge function regression #357 (
7927908)
0.23.1
Section titled “0.23.1”Patch Changes
Section titled “Patch Changes”- Fix wrong import path in generated files (
9b19633)
0.23.0
Section titled “0.23.0”Minor Changes
Section titled “Minor Changes”-
Allow async initialization of storage handlers (
e5306c2) -
Add support for configuring what query params are trimmed in the vite plugin (
2d8462e) -
Add
migrateStoragefunction to assist migrating between different storages (ba05cf2)This function can itself be used as a storage config. For example, to migrate from the PO file to JSON:
wuchale.config.js import { defineConfig, pofile, migrateStorage } from "wuchale";import { json } from "@wuchale/json";export default defineConfig({// ...adapters: {main: svelte({// ...storage: migrateStorage([pofile()], json()),}),},});After running
npx wuchalewith this config, it can be replaced by the target storage config.
0.22.11
Section titled “0.22.11”Patch Changes
Section titled “Patch Changes”- Fix wrong handler order when running
npx wuchale check --full#342 (18368ae)
0.22.10
Section titled “0.22.10”Patch Changes
Section titled “Patch Changes”- Fix incorrect behavior on
npx wuchale check --full#342 (#344)
0.22.9
Section titled “0.22.9”Patch Changes
Section titled “Patch Changes”- Windows: fix wrong import path separator for url manifests (
5abd24a)
0.22.8
Section titled “0.22.8”Patch Changes
Section titled “Patch Changes”- Fix AI translate not strictly respecting batchSize config (#329)
0.22.7
Section titled “0.22.7”Patch Changes
Section titled “Patch Changes”- Fix parsing errors when
</script>appears in HMR strings in script blocks (ad74ebb)
0.22.6
Section titled “0.22.6”Patch Changes
Section titled “Patch Changes”- Include no HMR code when on SSR (
bbc828d)
0.22.5
Section titled “0.22.5”Patch Changes
Section titled “Patch Changes”-
Fix items not marked obsolete for no longer existent files on cli without
--clean(23ebbab) -
Fix pofile storage not following
localesDirby default (#305) -
Fix AI translate not working after removing item.id property (
ad8d5f7)
0.22.4
Section titled “0.22.4”Patch Changes
Section titled “Patch Changes”- Fix deleted file not resulting in catalog item obsolete/cleaning #313. Now both file deletion and
filespattern updates result in obsoletes/catalog cleaning (a7d8d47)
0.22.3
Section titled “0.22.3”Patch Changes
Section titled “Patch Changes”- Fix HMR being disabled when running cli while dev server is running #306 (
25a1425)
0.22.2
Section titled “0.22.2”Patch Changes
Section titled “Patch Changes”- Vite: Fix unnecessary full reloads instead of HMR (
49e03bb)
0.22.1
Section titled “0.22.1”Patch Changes
Section titled “Patch Changes”-
Fix full reload happening when writing to confUpdate.json (
ffc5d2a) -
Fix unclosed tags of nested messages not considered an error on compile (
f510e3a) -
Fix
localesDirnot being resolved from project root when it’s not cwd (5ad8f3a) -
Always normalize separators to fix
filespatterns not matching on windows (9c7b6e9) -
Fix wrong handling of adjacent expressions in tagged templates at runtime (
43fabca) -
Fix different paths resolving to the same location being considered different pofile storage keys (
808edcf) -
Fix regression: transform errors not formatted for Vite (
8f2cfd6) -
Fix pofile storage round trip issues and make it resistant to missing items in some catalogs (
f0feafb) -
Fix AI translate being rejected for locales with more than 2 plural forms, and bad translations being persisted after retries (
92dbf5f) -
Fix crash when sourceLocale is not the first in locales array (
31ed422) -
Fix error thrown on String.raw with extracted string at runtime (
62c3691) -
Fix $props with default value string being wrapped in $derived (
44ceec8)
0.22.0
Section titled “0.22.0”Minor Changes
Section titled “Minor Changes”-
Add
npx wuchale checkcommand to check translation structures for missing placeholders etc. #274 (d53178a) -
Remove
.idfield of items (relevant only if you use a custom storage) (2f195f3) -
Add
wuchale check --fullcommand to check if there are any unchecked changes, visits all files to see if there are unextracted messages #274 (346f49f) -
Add support for JSON output on
statuscommand (85c7473)The command
npx wuchale statusnow accepts the--jsonflag and can print the info in a structured JSON format. This can be used to use for e.g. to check the number of untranslated items usingjqin CI etc. -
Write catalog manifest files to know which index in compiled catalog comes from which key in catalog (#288)
-
BREAKING: Merge vite plugin logic into core to share with cli (#289)
The vite plugin will no longer be a separate package. It is now included in the
wuchalepackage. You should update your vite plugin:vite.config.js import {wuchale} from '@wuchale/vite-plugin'import {wuchale} from 'wuchale/vite'
Patch Changes
Section titled “Patch Changes”-
Validate plural rules and check for anything suspecious (
89fec64)Plural rules that come from the catalogs set by translators are now validated to be ternary expressions in the expected format for correctness, as well as security reasons (although the risk is low)
-
Fix error by adding
;when there is iife right after runtime init (#293) -
Fix error when adding a new locale to an existing project #294 (
eb49dc8) -
Fix wrong
topLevelCallin heuristic details on destructuring assignments (b7f362c) -
Trim
?t=...in addition to?v=...before matching files in vite plugin (thanks @mustafa0x) (#290)
0.21.2
Section titled “0.21.2”Patch Changes
Section titled “Patch Changes”-
Fix expressions inside TS
asand<assert>expressions not checked when setting heuristictopLevelCallwhich led to Svelte$derived(...) as Typebeing wrapped in another$derived(333c64a) -
Fix strings inside arrow function arguments to top level calls (e.g.
$effect(() => {...})) not being extracted (d8a45ef)
0.21.1
Section titled “0.21.1”Patch Changes
Section titled “Patch Changes”- Make AI translate more robust against malformed LLM output (
67f0a99)
0.21.0
Section titled “0.21.0”Minor Changes
Section titled “Minor Changes”-
Add support for grouping locales for AI translation (
1dcd46c)You can now group target locales in the same prompt:
export default {// ...ai: {// ...group: {// en is the sourceen: [["fr", "fr-FR", "fr-CH"],["de", "fr-DE"],],},},}; -
Add support for keeping whole markups as single units (
9bb41c5)You can now use the new comment directive:
<!-- @wc-unit --><div><p>Parag 1</p><p>Parag 2</p><p>Parag 3</p></div>And it the whole will be extracted as a single message
-
Add support for pluggable storage handlers (#271)
While the PO for format is a solid choice for most cases, there may be some cases where another format is desired. Therefore, support for storing messages in PO files will continue to be provided out of the box but there will be an interface where another format can be plugged instead. The basic usage will be as a config option to the adapter like:
export default {// ...adapters: {main: svelte({// ...storage: pofile({ dir: "..." }),}),},};And the storage key can accept any implementation that supports the expected shape for a storage collection.
-
Validate AI translation response for correct placeholders and structure (
e7d8d85) -
localesDiris now always shared, and data.js doesn’t exportsourceLocale(121e98e)You can put the catalogs in different locations by configuring the
dirfor thepofilestorage as mentioned. But everything wuchale works on is inside a single dir, configurable from the top level configlocalesDir:export default {// ...localesDir: "src/locales",};All files inside that dir are per adapter, except
data.jswhich exported shared data,localesandsourceLocale. NowsourceLocaleis not exported because it may be different among adapters. You may have to adjust something if you use it. -
Add support for importing a URL localize function from any module at runtime (
347ca5e)This adds support for cases where complete flexibility is needed for URLs, for example when the site targets different domain names for different locales, and when one locale can be used in different domains. Now a custom localize function that does the localization can be implemented, and wuchale only handles the translation. This can be used by providing the module path:
export default {// ...adapters: {svelte({url: {localize: 'src/lib/url-util.js',patterns: [// ...]}})}}The module has to export a
localizefunction that is of type:type URLLocalizer = (url: string, locale: string) => string;To just use the default of prefixing the locale to the path, set
localize: true.
0.20.0
Section titled “0.20.0”Minor Changes
Section titled “Minor Changes”-
Add support for locale fallback chains (
8ff01c4)This is only for when the message is not yet translated. With no configuration, for locales that have regional variants like
fr-CH, it falls back to the base onefr. And explicit chains can be configured by providing from-to pairs in thefallbackkey:wuchale.config.js export default {// ...fallback: {"fr-CH": "fr-FR","fr-FR": "fr-ES",},// ...};And then the chain for would be
fr-CH->fr-FR->fr-ES->fr->en. -
URL translations in separate catalog
.url.pofiles (843544b) -
Store references for URL items just like any other message, and use it to avoid startup visit (#250)
0.19.4
Section titled “0.19.4”Patch Changes
Section titled “Patch Changes”- Fix possible type error on generated compiled catalogs when using plural functions (
324fb80)
0.19.3
Section titled “0.19.3”Patch Changes
Section titled “Patch Changes”- Fix multiple issues revealed in #234 (
2966ded)
0.19.2
Section titled “0.19.2”Patch Changes
Section titled “Patch Changes”- Allow return outside function for astro frontmatter (
823f78e)
0.19.1
Section titled “0.19.1”Patch Changes
Section titled “Patch Changes”- Fix possible infinite retries on ai translate error/mistake (
2b9a61a)
0.19.0
Section titled “0.19.0”Minor Changes
Section titled “Minor Changes”-
3ca7aac: Accept .ts and .mts config files because node 22+ supports them
-
9de6b79: Make it easier to choose non-reactive runtime function
by setting
runtime.useReactivein the adapter config. -
fad845d: Add a flag
--log-levelto the CLI and use it for all outputs when extracting -
197bb11: Accept Gemini model code as config
-
64f7485: BREAKING: Update locales config to support for 3rd party component libraries
The
sourceLocaleis now configured on a per-adapter basis, and on the top level, all desiredlocaleshave to be specified.You have to make some changes to your config:
{sourceLocale: 'en',otherLocales: ['es', 'fr'],locales: ['en', 'es', 'fr'],adapters: {main: svelte({sourceLocale: 'en',// ...})}}Additionally, the
sourceLocaleon the adapter defaults to the first locale in the mainlocalesarray.This allows the use of multiple languages in the source code, which may be necessary when you are trying to write the source in another language and you want to use a 3rd party lib written in English for example.
And now to use 3rd party component libraries, you can specify the file locations in the package dir under
node_modules:wuchale.config.js {//...adapters: {lib: svelte({files: "node_modules/foo-lib/dist/*.svelte",});}}And additionally, to make sure that Vite doesn’t interfere during dev, you can exclude the library from startup optimization:
vite.config.js export default defineConfig({optimizeDeps: {exclude: ["foo-lib"],},}); -
63fb176: Add support for delaying setting the current locale after loading the catalogs (#163)
You can now use
commitLocaleafterloadLocale(locale, false)to separate loading from rendering. This can solve SvelteKit rendering the other locale on hover over the language link when preloading is on, by using it in$effect.pre. PreviouslyloadLocaleacceptedkeyas the second argument to selectively load catalogs by adapter key. It will now load all available catalogs. -
f92c641: Use
_w_runtime_(...)instead of_w_runtime_.t(...)to further reduce bundle size
0.18.11
Section titled “0.18.11”Patch Changes
Section titled “Patch Changes”- ae355a5: Fix windows file path difference preventing hot reload on edit po files
0.18.10
Section titled “0.18.10”Patch Changes
Section titled “Patch Changes”- 3b0e87b: Update Gemini default version to 2.5 (for #218)
0.18.9
Section titled “0.18.9”Patch Changes
Section titled “Patch Changes”- 67655b3: Fix messages belonging to files matched by removed patterns surviving
--clean#200
0.18.8
Section titled “0.18.8”Patch Changes
Section titled “Patch Changes”- 926aa60: Fix type error on proxies when
noUncheckedIndexedAccessis true #202 - 7471ce3: Fix translation not showing when writing po file after adding new message in source #204
0.18.7
Section titled “0.18.7”Patch Changes
Section titled “Patch Changes”- 82c4cf9: Fix
<style lang="scss">causing problems in Svelte
0.18.6
Section titled “0.18.6”Patch Changes
Section titled “Patch Changes”- 6af0d52: Fix error on for loops with some conditions missing #197
- 0a4e3df: Remove surrounding unnecessary quotes when transforming attributes #191
- 1b511c3: Fix parsing crashing on TS abstract class declarations #189
- 5ce8212: Fix switch and try statements not being visited #198
- 885c131: Fix type errors because of generated compiled catalogs not being typed
0.18.5
Section titled “0.18.5”Patch Changes
Section titled “Patch Changes”- 44a6d24: Fix
... as typeand<type>...expressions in TS not visited sometimes - f861f78: Use proper hook name to get reactive runtime in React #181
0.18.4
Section titled “0.18.4”Patch Changes
Section titled “Patch Changes”- ff87ab3: Don’t update PO-Revision-Date header on extract, should be set by translation tool/platform
0.18.3
Section titled “0.18.3”Patch Changes
Section titled “Patch Changes”- a1a31f9: Fix errors during build due to granular load IDs and TS types
0.18.2
Section titled “0.18.2”Patch Changes
Section titled “Patch Changes”-
4a8ba3d: Fix runtime initialization sometimes after early exits in functions
Causing errors in React apps
-
db45dff: Fix default loader templates, remove obsolete comments
-
5b0a570: Fix
customloader in config causing errors
0.18.1
Section titled “0.18.1”Patch Changes
Section titled “Patch Changes”- 978aaa4: Fix compiled catalogs not written on build
0.18.0
Section titled “0.18.0”Minor Changes
Section titled “Minor Changes”-
37deb80: Always use physical files, change
catalogconfig tolocalesDirPreviusly virtual modules offered by Vite made it possible to keep the file system clean and a slight performance advantage when building, but they had disadvantages:
- Inspecting what Wuchale generates was not possible unless the
writeFilesconfig was enabled - They don’t work outside of Vite
- Supporting physical files was therefore unavoidable and that meant supporting two different systems to export the same things
Now everything is written to disk, including proxies, compiled catalogs, and locales data too. And
writeFileshas been removed. In cases where writing the transformed code is desired, the destination can be provided to theoutDiradapter config.The second thing is that the location of the catalog files was previusly specified using the
catalogadapter config, which accepted a substitution parameter,{locale}but it’s an unnecessary complexity that can lead to problems, and it’s not just catalogs that’s stored in that location. Therefore, it has been replaced by the self descriptive config,localesDir. - Inspecting what Wuchale generates was not possible unless the
-
37deb80: Improve base heuristic to avoid ALLCAPS like POST and EUR, with no lowercase like “M 0,0” in script and attributes
-
37deb80: Removed the
initCLI command. Loaders are now specified in the config. And they have to exportgetRuntimeandgetRuntimeRx.The interactive
initcommand was mainly created to scaffold loaders. But since most devs don’t touch the loaders and since updates to what the loaders are expected to export and their locations is not that straightforward to keep up with the package updates, the command has been removed, and the loaders can be specified in the adapter configuration using the keyloader.The loader config can take some default included loaders and additionally
customas a value. For example, the Svelte adapter can accept the valuessvelte,sveltekitandcustom.Specifying the included loaders (
svelteorsveltekitin the example case) means you don’t want to control their content and want to use the default. And so the loader(s) contents are (over)written at dev server startup or theextractcommand. That way, they are automatically kept up to date with the package. But if you want to do custom stuff with the loaders, and don’t want them to be overwritten, you can specifycustom.The location of the loaders is next to the catalogs, and follows this naming convention:
{adapter key}.loader[.server].{loader extension}For example, for a SvelteKit project, it can be:
main.loader.svelte.js(client) andmain.loader.server.svelte.js(server). Therefore, if you take ownership of these files and do custom stuff, you can specifycustomin the adapter config.And next, the (custom) loaders have to export functions
getRuntimeandgetRuntimeRxafter wrapping the loaded catalogs withtoRuntimefromwuchale/runtime. -
37deb80: Provide locale as an rgument option for patterns for easy l10n
You can now use pure functions for l10n like currency and date, etc.
For example, you can define the function:
function currency(num, loc = "en") {return new Intl.NumberFormat(loc, {style: "currency",currency: "EUR",}).format(num);}And specify the pattern in the config:
// ...adapters: {main: svelte({loader: 'sveltekit',patterns: [{name: 'currency', args: ['other', 'locale']},]}),// ...And when you use it like normal:
<p>{currency(123456.789)}</p>It will produce localized variants based on the locale:
en:€123,456.79es:123.456,79 €fr:123 456,79 €
You can use it with ANY l10n approach, you just have to specify the pattern.
-
37deb80: Run a pre scan and compile catalogs before build to prevent race conditions
This solves the problem where you start the build process with some messages in the code not yet extracted to the PO files, and are discovered during the build process, which causes the PO file and subsequently the compiled catalogs to be modified, during build. That causes a race condition and makes the build process fail because of a syntax error (the compiled catalog is read while only half of it is written.)
Additionally, with the new URL handling, links are not directly translated, their translation is derived from the URL pattern translations. That removes the need to store them in the PO files, just the patterns. But that also means they are not known at the start of the build process, which causes the above problem.
Now all extraction and compilation of messages is performed prior to the build, during build, no PO file writes or compiles are performed, only code transformations happen. This makes builds deterministic.
-
9d1dff8: Add support for translating URL paths!
This is the biggest addition on this release. Internationalizing URL paths is now possible, with the same conveniences of no/minimal code changes, while respecting the fact that URLs are to be handled carefully.
There are two parts to this:
- Translation: e.g.
/aboutto/uber-uns - Localization: e.g.
/aboutto/en/about
Full guide coming soon in the docs!
- Translation: e.g.
0.17.5
Section titled “0.17.5”Patch Changes
Section titled “Patch Changes”- 5c8cea6: Fix chain expressions (JS) and render tags (Svelte) not being visited
0.17.4
Section titled “0.17.4”Patch Changes
Section titled “Patch Changes”- a955579: Visit @const declarations in svelte, more compatibility
0.17.3
Section titled “0.17.3”Patch Changes
Section titled “Patch Changes”- 280ad8d: Fix tagged template strings not extracted
0.17.2
Section titled “0.17.2”Patch Changes
Section titled “Patch Changes”- 51778eb: Fix patterns not working for template literals
0.17.1
Section titled “0.17.1”Patch Changes
Section titled “Patch Changes”- 6a9b651: Fix config with
files: {include: ..., ignore: ...}not working, and improve verbose output - 8e2611d: Export and document all default heuristic functions
0.17.0
Section titled “0.17.0”Minor Changes
Section titled “Minor Changes”-
5a221a2: Expose interface to make AI translator customizable
You can now use a custom translator model other than Gemini by supplying the info in the config:
export default {//...ai: {name: "ChatGPT", // e.g.batchSize: 50,parallel: 10,translate: (content, instruction) => {// logicreturn translatedContent;},},//...};Gemini is still the default, but now it’s separated out and was made customizable:
import { gemini } from "wuchale";export default {//...ai: gemini({batchSize: 40,parallel: 5,think: true, // default: false}),//...}; -
15cf377: Pass whole message to heuristic function, with context
-
0b5c207: Svelte: auto wrap variable declarations by
$derivedas needed instead of requiring it in the code -
16b116c: Customizable log levels, add verbose level where all extracted messages are shown
-
22198c1: Redesign status command output with tables
-
d531bcc: Add support for multiple custom patterns to support full l10n
For example, if you want to use
Intl.MessageFormatfor everything it supports including plurals, you add a signature pattern for a utility function in the config:// ...adapters: js({patterns: [{name: "formatMsg",args: ["message", "other"],},],});//...Then you create your reusable utility function with that name:
// where you get the localelet locale = "en";export function formatMsg(msg, args) {return new IntlMessageFormat(msg, locale).format(args);}And use it anywhere:
const msg = formatMsg(`{numPhotos, plural,=0 {You have no photos.}=1 {You have one photo.}other {You have # photos.}}`,{ numPhotos: 1000 });Then wuchale will extract and transform it into:
const msg = formatMsg(_w_runtime_.t(0), { numPhotos: 1000 }); -
9f997c2: Add
--syncflag for the CLI command to process files sequentially
Patch Changes
Section titled “Patch Changes”- 6d0a4d3: Make
wuchale --cleanidempotent and write once at the end
0.16.5
Section titled “0.16.5”Patch Changes
Section titled “Patch Changes”- 1d57789: Fix locales not separate when written to proxy
0.16.4
Section titled “0.16.4”Patch Changes
Section titled “Patch Changes”-
5aa768a: Ignore form method attribute and fetch calls
-
0352c60: Fix issues around arrow functions and function expressions
These are technically functions but their bodies are not block statement bodies, but expressions. For this reason, they were ignored when they are defined at the top level and when they are inside functions, they would use the runtime instance of their parent. Now their own bodies are tuned into block statement bodies:
const foo = () => "Hello";Now becomes:
const foo = () => {const _w_runtime_ = _w_to_rt_(_w_load_("main"));return _w_runtime_.t(0);};This allows them to be defined at the top level and they should still get their contents properly extracted.
-
04e28a3: Fix initialization outside
<script>when the<script>is empty
0.16.3
Section titled “0.16.3”Patch Changes
Section titled “Patch Changes”- 4210ee1: Fix error on empty body content when trying to get body start (e.g. in empty
<script>)
0.16.2
Section titled “0.16.2”Patch Changes
Section titled “Patch Changes”- f7c0225: Fix class declarations not visited
0.16.1
Section titled “0.16.1”Patch Changes
Section titled “Patch Changes”- 973848b: Fix HMR having problems with lazy loaded files
0.16.0
Section titled “0.16.0”Minor Changes
Section titled “Minor Changes”-
fef0d11: Add the
@wc-ignore-filecomment directiveAs an alternative to ignoring a file in the
filesconfig value, you can now ignore a whole file by putting this directive at the beginning of the file, before any extractable messages. The advantage is that it doesn’t need a restart of the dev server and if you rename/move the file it will always be ignored. -
4fcf264: Add support for .mjs config as default
-
46aa3f2: Export locales from proxy when
writeFilesis enabled for server to not need tweaking the default loader -
37367ca: Add placeholder context comments into PO file
-
f07d484: Gemini: translate in batches of 50 max, auto retry with status messages
This is useful for one off translation, usually just after adding wuchale to a big project. Gemini sometimes doesn’t translate all messages when it’s given too many, so this update batches the messages into groups of ~50, and when not all of them are translated, shows a message and tries again, until all of them are translated.
0.15.8
Section titled “0.15.8”Patch Changes
Section titled “Patch Changes”- 3d5d73a: Solve issues with paths on windows
0.15.7
Section titled “0.15.7”Patch Changes
Section titled “Patch Changes”- 957574f: Fix sequence expressions not visited
- 0223e40: Fix cli with –clean removing all messages not belonging to the last adapter out of those sharing a catalog
0.15.6
Section titled “0.15.6”Patch Changes
Section titled “Patch Changes”- 485f5fe: Fix .svelte files with