Skip to content

@wuchale/astro

  • d3dde62: Fix unexpected top level strings being extracted
  • Updated dependencies [d3dde62]:
    • wuchale@0.26.4
  • dc0eb48: Add proper Astro integration that simplifies config

    There is now a proper Astro integration instead of using the Vite plugin in the Astro config and configuring additional things. You can now just have

    astro.config.mjs
    import { wuchale } from '@wuchale/astro/integration'
    import { defineConfig } from 'astro/config'
    export default defineConfig({
    integrations: [wuchale()]
    });
  • 15d677e: ⚠️ BREAKING: Replace single details object with an array of scope objects and separate filename for heuristic

    The heuristic function now gets called with two arguments: the extracted Text object, and the filename as a string argument. The Text object now has:

    • .body: string | string[] instead of Message.msgStr
    • .path: Scope[] instead of Message.details - this is an array of different small Scope objects that better conveys nesting information.
    • The rest of the properties are the same as Message

    Therefore if you implement a custom heuristic function you should for example:

    heuristic: (msg) => {
    heuristic: (text, file) => {
    if (msg.details.element || msg.details.file.endsWith('.foo')) {
    if (text.path.some(s => s.type === 'element') || file.endsWith('.foo')) {
    return false
    }
    }

    The scope array is now used to ignore whole sub-trees of ignored elements even if they contain non-ignored elements.

  • b43c360: Vite: add injected components in optimizeDeps.exclude to prevent startup reload causing test errors #437
  • abb3f14: When nesting functions with messages, initialize runtime at the inner most function with messages #436
  • Updated dependencies [8aa70f2, ecb2626, b43c360, f28e7b4, 5be7308, abb3f14, cd53445, 91ac506, 15d677e, 07cff73]:
    • wuchale@0.26.0
  • c46696a: Fix new mixed visitor visiting ignored elements when nested #408
  • Updated dependencies [c46696a, 40b5c42]:
    • wuchale@0.25.6
  • d4ef202: Fix inconsistent handling of nested messages with non-nestable block types #402
  • Updated dependencies [d4ef202]:
    • wuchale@0.25.4
  • fa12c12: Limit nesting to only element-like nodes to fix unexpected errors (e.g. around {#if})
  • Updated dependencies [fa12c12]:
    • wuchale@0.25.3
  • 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.

  • Updated dependencies [3c88ee9]:

    • wuchale@0.25.0
  • ⚠️ BREAKING: reorganize loading config, use glob patterns and number load IDs (#355)

    • granularLoad is now loading.granular
    • bundleLoad is now loading.direct
    • generateLoadID is replaced by a glob config at loading.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*',
    ]
    }
    }),
    }
    })
  • ⚠️ BREAKING: proxies now export loadCount instead of loadIDs after #355 (f903655)

    The default loaders have been updated to match but if you use loadLocales in 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: Rename config hmr to dev with the following options to control behavior during dev: (#377)

    • false: Same behavior as the previous hmr: 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 previous hmr: true, adds new messages, updates refs and marks obsoletes
    • 'clean': Full behavior same as npx wuchale --clean, deletes unused messages
  • Updated dependencies [2005ea1, 89b650b, 94ce7fc, 4899ae6, f903655, 4bbbbae, 589fbca, 4922b03, 3567c7f, 2521033, 5063533, 6d5e244]:

    • wuchale@0.24.0
  • Extract strings in export const in Astro frontmatter only if they are inside functions and init runtime inside to prevent errors #372 (500616b)

  • Updated dependencies [500616b]:

    • wuchale@0.23.4
  • Fix error on export const ... statements in frontmatter #372 (93bef85)
  • 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 localize function 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.

  • Fix error on empty file (regression fix) (2b1f249)

  • Updated dependencies [324fb80]:

    • wuchale@0.19.4
  • Fix error when parsing self closing tags in expressions due to astro’s limitation (1d5ec83)
  • Fix various parsing errors caused by differences in offset units (bytes in go, indices in js) when files contain unicode characters (67c4e82)
  • Allow return outside function for astro frontmatter (823f78e)

  • Updated dependencies [823f78e]:

    • wuchale@0.19.2
  • Fix parsing errors on object attributes, visit spread attributes (8fda2a4)
  • Fix error on empty file (3334c2a)
  • Fix possible infinite retries on ai translate error/mistake (2b9a61a)

  • Updated dependencies [2b9a61a]:

    • wuchale@0.19.1
  • 5f1499b: Add the Astro adapter! Thank you @tarekwiz for starting it!
  • Updated dependencies [3ca7aac]
  • Updated dependencies [9de6b79]
  • Updated dependencies [fad845d]
  • Updated dependencies [197bb11]
  • Updated dependencies [64f7485]
  • Updated dependencies [63fb176]
  • Updated dependencies [f92c641]
    • wuchale@0.19.0