diff --git a/_app/immutable/chunks/BJ41t_xM.js b/_app/immutable/chunks/B1J5vlOb.js similarity index 99% rename from _app/immutable/chunks/BJ41t_xM.js rename to _app/immutable/chunks/B1J5vlOb.js index ddeb3c9df..e0bff65c4 100644 --- a/_app/immutable/chunks/BJ41t_xM.js +++ b/_app/immutable/chunks/B1J5vlOb.js @@ -1,4 +1,4 @@ -import{a as $,t as L}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{p as F,n as g,g as v,o as H,s as c,c as i,t as M,r as C,a0 as O,a1 as K,a2 as I,f as z,aw as _}from"./C7ybvbG6.js";import{s as N}from"./Pm9v8Z5x.js";import{b as U}from"./qc0iZXgO.js";import{R as x}from"./C9KGm8gN.js";import{F as m,a as f,b as h,c as A,E as b,f as j,h as T,j as B}from"./RBm6SzXJ.js";import{i as w}from"./9wtrq6xj.js";import{L as d}from"./sm3p1Cgt.js";import{b as q}from"./CT42DmWV.js";import{p as V,s as J}from"./Cb01ZQJJ.js";function G(e,s){F(s,!1);const n="hello = Hello, world!",a=new m("en");a.addResource(new f(n)),h(()=>A([a])),w(),d(e,{id:"hello"}),g()}const Q=`
<script>
+import{a as $,t as L}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{p as F,n as g,g as v,o as H,s as c,c as i,t as M,r as C,a0 as O,a1 as K,a2 as I,f as z,aw as _}from"./C7ybvbG6.js";import{s as N}from"./Pm9v8Z5x.js";import{b as U}from"./D0WVFpiq.js";import{R as x}from"./DXIQJq6t.js";import{F as m,a as f,b as h,c as A,E as b,f as j,h as T,j as B}from"./RBm6SzXJ.js";import{i as w}from"./9wtrq6xj.js";import{L as d}from"./sm3p1Cgt.js";import{b as q}from"./CT42DmWV.js";import{p as V,s as J}from"./Cb01ZQJJ.js";function G(e,s){F(s,!1);const n="hello = Hello, world!",a=new m("en");a.addResource(new f(n)),h(()=>A([a])),w(),d(e,{id:"hello"}),g()}const Q=`
<script>
 	import { FluentBundle, FluentResource } from '@fluent/bundle';
 	import { createSvelteFluent, initFluentContext, Localized } from '@nubolab-ffwd/svelte-fluent';
 
diff --git a/_app/immutable/chunks/pBxkpSOH.js b/_app/immutable/chunks/B1l9QTtp.js
similarity index 76%
rename from _app/immutable/chunks/pBxkpSOH.js
rename to _app/immutable/chunks/B1l9QTtp.js
index 5567fa9fd..33c5724aa 100644
--- a/_app/immutable/chunks/pBxkpSOH.js
+++ b/_app/immutable/chunks/B1l9QTtp.js
@@ -1 +1 @@
-import{m as i}from"./UNhKW_vC.js";import{m as l}from"./BKiJ3o1Z.js";import{b as o}from"./qc0iZXgO.js";const c=(s,e)=>s.startsWith(e)?s.slice(e.length):s,n=(s,e)=>s.endsWith(e)?s.slice(0,-e.length):s,r=Object.fromEntries(Object.entries(Object.assign({"./Localized/+page.svelte.md":i,"./Overlay/+page.svelte.md":l})).map(([s,e])=>[n(c(s,"./"),"/+page.svelte.md"),e])),t=Object.entries(r).map(([s,e])=>({text:(e==null?void 0:e.menuTitle)??(e==null?void 0:e.title),title:e==null?void 0:e.title,href:o+"/docs/legacy/"+s}));export{t as s};
+import{m as i}from"./Cla8vzo_.js";import{m as l}from"./CFnW3eWN.js";import{b as o}from"./D0WVFpiq.js";const c=(s,e)=>s.startsWith(e)?s.slice(e.length):s,n=(s,e)=>s.endsWith(e)?s.slice(0,-e.length):s,r=Object.fromEntries(Object.entries(Object.assign({"./Localized/+page.svelte.md":i,"./Overlay/+page.svelte.md":l})).map(([s,e])=>[n(c(s,"./"),"/+page.svelte.md"),e])),t=Object.entries(r).map(([s,e])=>({text:(e==null?void 0:e.menuTitle)??(e==null?void 0:e.title),title:e==null?void 0:e.title,href:o+"/docs/legacy/"+s}));export{t as s};
diff --git a/_app/immutable/chunks/CIxP2z4r.js b/_app/immutable/chunks/BDSGbctU.js
similarity index 99%
rename from _app/immutable/chunks/CIxP2z4r.js
rename to _app/immutable/chunks/BDSGbctU.js
index ae07cb96b..01a21c9de 100644
--- a/_app/immutable/chunks/CIxP2z4r.js
+++ b/_app/immutable/chunks/BDSGbctU.js
@@ -1,4 +1,4 @@
-import{n as u,a as i,t as D}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{p as l,n as t,f as R,s as a,c as y,aw as A,r as C}from"./C7ybvbG6.js";import{h as P}from"./Dc5pHhiR.js";import{R as r}from"./C9KGm8gN.js";import{a as h,d as m,F as f,b,c as x,E}from"./RBm6SzXJ.js";import{i as p}from"./9wtrq6xj.js";const q=`hello = Hello, world!
+import{n as u,a as i,t as D}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{p as l,n as t,f as R,s as a,c as y,aw as A,r as C}from"./C7ybvbG6.js";import{h as P}from"./Dc5pHhiR.js";import{R as r}from"./DXIQJq6t.js";import{a as h,d as m,F as f,b,c as x,E}from"./RBm6SzXJ.js";import{i as p}from"./9wtrq6xj.js";const q=`hello = Hello, world!
 `,T=new h(q);var B=(n,s)=>window.alert(s("hello")),H=D("");function I(n,s){l(s,!1);const{localize:o}=m();p();var e=H();e.__click=[B,o],i(n,e),t()}u(["click"]);function L(n,s){l(s,!1);const o=new f("en");o.addResource(T),b(()=>x([o])),p(),I(n,{}),t()}const Y=`
<script>
 	import { getFluentContext } from '@nubolab-ffwd/svelte-fluent';
 	const { localize } = getFluentContext();
diff --git a/_app/immutable/chunks/LcMkLfTL.js b/_app/immutable/chunks/BDfTt2xC.js
similarity index 93%
rename from _app/immutable/chunks/LcMkLfTL.js
rename to _app/immutable/chunks/BDfTt2xC.js
index 2cb36db4c..c549acfaa 100644
--- a/_app/immutable/chunks/LcMkLfTL.js
+++ b/_app/immutable/chunks/BDfTt2xC.js
@@ -1 +1 @@
-import{a as D,t as h}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{f as u,s as e,c as r,aw as l,r as p}from"./C7ybvbG6.js";import{h as v}from"./Dc5pHhiR.js";import{R as c}from"./C9KGm8gN.js";const f={title:"getFluentContext"},{title:x}=f;var C=h('

Retrieves the current objects from the svelte context.

Return value

The object.

',1);function k(i){var a=C(),n=u(a);n.textContent=x;var t=e(n,2),m=e(r(t));c(m,{name:"FluentContext"}),l(),p(t);var o=e(t,2);v(o,()=>'
const { localize } = getFluentContext();
');var s=e(o,4),d=e(r(s));c(d,{name:"FluentContext"}),l(),p(s),D(i,a)}export{k as _,f as m}; +import{a as D,t as h}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{f as u,s as e,c as r,aw as l,r as p}from"./C7ybvbG6.js";import{h as v}from"./Dc5pHhiR.js";import{R as c}from"./DXIQJq6t.js";const f={title:"getFluentContext"},{title:x}=f;var C=h('

Retrieves the current objects from the svelte context.

Return value

The object.

',1);function k(i){var a=C(),n=u(a);n.textContent=x;var t=e(n,2),m=e(r(t));c(m,{name:"FluentContext"}),l(),p(t);var o=e(t,2);v(o,()=>'
const { localize } = getFluentContext();
');var s=e(o,4),d=e(r(s));c(d,{name:"FluentContext"}),l(),p(s),D(i,a)}export{k as _,f as m}; diff --git a/_app/immutable/chunks/C9YSdwI3.js b/_app/immutable/chunks/BeqFGa4x.js similarity index 73% rename from _app/immutable/chunks/C9YSdwI3.js rename to _app/immutable/chunks/BeqFGa4x.js index 19bef9059..e3a1c300c 100644 --- a/_app/immutable/chunks/C9YSdwI3.js +++ b/_app/immutable/chunks/BeqFGa4x.js @@ -1 +1 @@ -import{m as s}from"./CIxP2z4r.js";import{m}from"./CQk4EaAR.js";import{m as o}from"./m7Zg_cw1.js";import{m as r}from"./Be-9h20U.js";import{m as i}from"./CssQdhbD.js";import{m as l}from"./6zcBDNlZ.js";import{m as n}from"./LcMkLfTL.js";import{m as p}from"./bcHiDdGq.js";import{b as c}from"./qc0iZXgO.js";const g=(t,e)=>t.startsWith(e)?t.slice(e.length):t,v=(t,e)=>t.endsWith(e)?t.slice(0,-e.length):t,f=Object.fromEntries(Object.entries(Object.assign({"./FluentContext/+page.svelte.md":s,"./FluentProvider/+page.svelte.md":m,"./Localized/+page.svelte.md":o,"./Overlay/+page.svelte.md":r,"./SvelteFluent/+page.svelte.md":i,"./createSvelteFluent/+page.svelte.md":l,"./getFluentContext/+page.svelte.md":n,"./initFluentContext/+page.svelte.md":p})).map(([t,e])=>[v(g(t,"./"),"/+page.svelte.md"),e])),j=Object.entries(f).map(([t,e])=>({text:(e==null?void 0:e.menuTitle)??(e==null?void 0:e.title),title:e==null?void 0:e.title,href:c+"/docs/reference/"+t}));export{j as s}; +import{m as s}from"./BDSGbctU.js";import{m}from"./CQk4EaAR.js";import{m as o}from"./m7Zg_cw1.js";import{m as r}from"./Be-9h20U.js";import{m as i}from"./FD3ZLI4D.js";import{m as l}from"./S-626CVF.js";import{m as n}from"./BDfTt2xC.js";import{m as p}from"./DjR93qC1.js";import{b as c}from"./D0WVFpiq.js";const g=(t,e)=>t.startsWith(e)?t.slice(e.length):t,v=(t,e)=>t.endsWith(e)?t.slice(0,-e.length):t,f=Object.fromEntries(Object.entries(Object.assign({"./FluentContext/+page.svelte.md":s,"./FluentProvider/+page.svelte.md":m,"./Localized/+page.svelte.md":o,"./Overlay/+page.svelte.md":r,"./SvelteFluent/+page.svelte.md":i,"./createSvelteFluent/+page.svelte.md":l,"./getFluentContext/+page.svelte.md":n,"./initFluentContext/+page.svelte.md":p})).map(([t,e])=>[v(g(t,"./"),"/+page.svelte.md"),e])),j=Object.entries(f).map(([t,e])=>({text:(e==null?void 0:e.menuTitle)??(e==null?void 0:e.title),title:e==null?void 0:e.title,href:c+"/docs/reference/"+t}));export{j as s}; diff --git a/_app/immutable/chunks/DHvtosUY.js b/_app/immutable/chunks/BqWRV_2Y.js similarity index 98% rename from _app/immutable/chunks/DHvtosUY.js rename to _app/immutable/chunks/BqWRV_2Y.js index d3d01c75d..5c9851467 100644 --- a/_app/immutable/chunks/DHvtosUY.js +++ b/_app/immutable/chunks/BqWRV_2Y.js @@ -1,4 +1,4 @@ -import{a as v,t as h}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{s,f as m,c as l,aw as d,r as o}from"./C7ybvbG6.js";import{h as a}from"./Dc5pHhiR.js";import{s as g}from"./Pm9v8Z5x.js";import{b as k}from"./qc0iZXgO.js";import{E}from"./CQxDgvJ-.js";import{R as b}from"./C9KGm8gN.js";const z=[{rank:1,text:"Getting started",id:"getting-started"},{rank:2,text:"What is svelte-fluent?",id:"what-is-svelte-fluent"},{rank:3,text:"Example",id:"example"},{rank:2,text:"Installation",id:"installation"},{rank:2,text:"Configure bundler",id:"configure-bundler"},{rank:3,text:"SvelteKit",id:"sveltekit"},{rank:3,text:"Vite",id:"vite"},{rank:3,text:"Rollup / Sapper",id:"rollup--sapper"}];var F=h(`

Getting started

What is svelte-fluent?

svelte-fluent is a svelte component library that aims to make it effortless to localize applications using +import{a as v,t as h}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{s,f as m,c as l,aw as d,r as o}from"./C7ybvbG6.js";import{h as a}from"./Dc5pHhiR.js";import{s as g}from"./Pm9v8Z5x.js";import{b as k}from"./D0WVFpiq.js";import{E}from"./CQxDgvJ-.js";import{R as b}from"./DXIQJq6t.js";const z=[{rank:1,text:"Getting started",id:"getting-started"},{rank:2,text:"What is svelte-fluent?",id:"what-is-svelte-fluent"},{rank:3,text:"Example",id:"example"},{rank:2,text:"Installation",id:"installation"},{rank:2,text:"Configure bundler",id:"configure-bundler"},{rank:3,text:"SvelteKit",id:"sveltekit"},{rank:3,text:"Vite",id:"vite"},{rank:3,text:"Rollup / Sapper",id:"rollup--sapper"}];var F=h(`

Getting started

What is svelte-fluent?

svelte-fluent is a svelte component library that aims to make it effortless to localize applications using the Fluent localization system by Mozilla.

Example

Installation

Using SvelteKit? Check out the SvelteKit integration guide!

Install svelte-fluent with your package manager of choice.

| Note: the jsdom dependency is for the server-side rendering of the component. It will not increase your frontend bundle size.

Configure bundler

You need to add the svelte-fluent plugin to your bundler configuration for all features to work. Currently vite and rollup are supported.

The plugin serves 2 functions:

  • It provides SSR support for the Overlay component.
  • It allows you to import .ftl files via import resources from 'path/to/messages.ftl', directly providing you a FluentResource instance instead of having to constructing your own from a string imported via Vite’s ?raw syntax.

SvelteKit

vite.config.js

Vite

vite.config.js

Rollup / Sapper

rollup.config.js

`,1);function K(y){var p=F(),t=s(m(p),8);E(t);var e=s(t,4),r=l(e),u=s(l(r));g(u,"href",`${k??""}/docs/integration#sveltekit`),d(),o(r),o(e);var i=s(e,4);a(i,()=>`
npm install --save-dev @nubolab-ffwd/svelte-fluent
 npm install --save jsdom
`);var n=s(i,2),C=s(l(n),3);b(C,{name:"Overlay"}),d(),o(n);var c=s(n,14);a(c,()=>`
import { sveltekit } from '@sveltejs/kit/vite';
diff --git a/_app/immutable/chunks/BA5z0fNS.js b/_app/immutable/chunks/C7Lh6-i1.js
similarity index 99%
rename from _app/immutable/chunks/BA5z0fNS.js
rename to _app/immutable/chunks/C7Lh6-i1.js
index 153bfd4e2..7c726031d 100644
--- a/_app/immutable/chunks/BA5z0fNS.js
+++ b/_app/immutable/chunks/C7Lh6-i1.js
@@ -1,4 +1,4 @@
-import{a as j,t as I}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{s,f as W,c as a,aw as e,r as o}from"./C7ybvbG6.js";import{h as n}from"./Dc5pHhiR.js";import{s as z}from"./Pm9v8Z5x.js";import{b as _}from"./qc0iZXgO.js";import{R as l}from"./C9KGm8gN.js";const N=[{rank:1,text:"Version 1",id:"version-1"},{rank:2,text:"What’s new?",id:"whats-new"},{rank:3,text:"Svelte 5 support",id:"svelte-5-support"},{rank:3,text:"Server-side localizations",id:"server-side-localizations"},{rank:3,text:"Loading .ftl files",id:"loading-ftl-files"},{rank:2,text:"Breaking changes",id:"breaking-changes"},{rank:2,text:"Migration Guide",id:"migration-guide"},{rank:3,text:"$localized store",id:"localized-store"},{rank:3,text:"FluentProvider deprecation",id:"fluentprovider-deprecation"},{rank:3,text:"Replace Localize/Overlay slots with snippets",id:"replace-localizeoverlay-slots-with-snippets"},{rank:3,text:"Continue using Localize/Overlay components with slots",id:"continue-using-localizeoverlay-components-with-slots"},{rank:3,text:"vite/rollup plugin import paths",id:"viterollup-plugin-import-paths"},{rank:3,text:"Ftl file loading",id:"ftl-file-loading"}];var G=I(`

Version 1

What’s new?

Svelte 5 support

Svelte 5 is now fully supported by svelte-fluent.

Server-side localizations

In previous versions, svelte-fluent could only be used inside of components. With the introduction +import{a as j,t as I}from"./BLmdulVr.js";import"./CrF5dDxS.js";import{s,f as W,c as a,aw as e,r as o}from"./C7ybvbG6.js";import{h as n}from"./Dc5pHhiR.js";import{s as z}from"./Pm9v8Z5x.js";import{b as _}from"./D0WVFpiq.js";import{R as l}from"./DXIQJq6t.js";const N=[{rank:1,text:"Version 1",id:"version-1"},{rank:2,text:"What’s new?",id:"whats-new"},{rank:3,text:"Svelte 5 support",id:"svelte-5-support"},{rank:3,text:"Server-side localizations",id:"server-side-localizations"},{rank:3,text:"Loading .ftl files",id:"loading-ftl-files"},{rank:2,text:"Breaking changes",id:"breaking-changes"},{rank:2,text:"Migration Guide",id:"migration-guide"},{rank:3,text:"$localized store",id:"localized-store"},{rank:3,text:"FluentProvider deprecation",id:"fluentprovider-deprecation"},{rank:3,text:"Replace Localize/Overlay slots with snippets",id:"replace-localizeoverlay-slots-with-snippets"},{rank:3,text:"Continue using Localize/Overlay components with slots",id:"continue-using-localizeoverlay-components-with-slots"},{rank:3,text:"vite/rollup plugin import paths",id:"viterollup-plugin-import-paths"},{rank:3,text:"Ftl file loading",id:"ftl-file-loading"}];var G=I(`

Version 1

What’s new?

Svelte 5 support

Svelte 5 is now fully supported by svelte-fluent.

Server-side localizations

In previous versions, svelte-fluent could only be used inside of components. With the introduction of the object in version 1, you can now use svelte-fluent anywhere you want.

For an example how to integrate it with SvelteKit .server.js files and form actions, check out the SvelteKit integration guide.

Loading .ftl files

The bundler plugin of svelte-fluent now allows you to directly import your .ftl files. Previous versions relied on loading the .ftl files as raw strings either via vite’s ?raw import or adding rollup-plugin-string.

Breaking changes