Skip to content

Commit c94e266

Browse files
committed
Document new features
1 parent 723c801 commit c94e266

File tree

8 files changed

+72
-16
lines changed

8 files changed

+72
-16
lines changed

locales/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@
7979
"getting-started.paragraph.create-translations-1": "Next create a folder to put your translations files in. I like to use",
8080
"getting-started.paragraph.create-translations-2": "at the root of the project, but really any folder will do.",
8181
"getting-started.paragraph.create-translations-3": "I recommend using JSON files but you can use use javascript with an object as their default export. Whatever the file extension, you translations inside are just regular strings in the ICU message syntax:",
82-
"getting-started.paragraph.create-translations-4": "I prefer shallow dictionaries like the one above, but you can also define translations using nested dictionaries.",
82+
"getting-started.paragraph.create-translations-5": "JSON is too constrained! I want more flexibility!",
83+
"getting-started.paragraph.create-translations-6": "You can also use JSON 5 features in your json files. That is, you can have comments, multi-line strings, single quotes, trailing commas... <br>It just works out of the box.",
84+
"getting-started.paragraph.create-translations-7": "I don't like curly braces",
85+
"getting-started.paragraph.create-translations-8": "Fair enough. If you like significant whitespace you can also use YAML files. Just use the .yaml or .yml extension names. If you are into that sort of things.",
86+
"getting-started.paragraph.create-translations-9": "I want even more features",
87+
"getting-started.paragraph.create-translations-10": "You can also define your translation in .js files, .ts files and .mjs files. Your module must export the object with the translations as its default export.",
8388
"getting-started.subsection.hook-into-sveltekit": "Hook the compiler into SvelteKit",
8489
"getting-started.paragraph.hook-into-sveltekit-1": "This library's build time compiler needs to hook into the build pipeline of your app. For that, add it to the list of vite plugins in your",
8590
"getting-started.paragraph.hook-into-sveltekit-2": "You are set, time to use the library.",

locales/es.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
"getting-started.paragraph.create-translations-2": "en la raiz del proyecto, pero en realidad puedes colocar el directorio donde tu prefieras",
8080
"getting-started.paragraph.create-translations-3": "Recomiendo usar ficheros .json pero puedes también crear ficheros javascript que exporten un único objeto que contiene las traducciones. Cualquiera que sea tu preferencia, las traducciones son simples cadenas con la sintaxis ICU:",
8181
"getting-started.paragraph.create-translations-4": "Yo prefiero el diccionario de traducciones tenga un único nivel y usar puntos para crear jerarquías como el de arriba, pero también puedes anidar objectos como a continuación:",
82+
"getting-started.paragraph.create-translations-5": "¡JSON es demasido rígido! ¡Quiero más flexibilidad!",
83+
"getting-started.paragraph.create-translations-6": "Puedes usar funcionalidades de JSON 5 en tus ficheros json. Por ejemplo, puedes usar comentarios, strings multi-línea, comillas simples, comas al final de línas... <br>Funciona automáticamente.",
84+
"getting-started.paragraph.create-translations-7": "No me gustan las llaves",
85+
"getting-started.paragraph.create-translations-8": "Como quieras. Si te gusta usar espacios puede puedes tambien utilizar ficheros YAML. Tan solo añade la extensión .yaml o .yml. Si es que te van esas cosas.",
86+
"getting-started.paragraph.create-translations-9": "Quiero más funcionalidades",
87+
"getting-started.paragraph.create-translations-10": "Puedes definir tus traducciones en ficheros .js, ficheros .ts y ficheros .mjs. El módulo debe exportar un objeto con las traducciones como su export por defecto.",
8288
"getting-started.subsection.hook-into-sveltekit": "Acomplar el compilador a SvelteKit",
8389
"getting-started.paragraph.hook-into-sveltekit-1": "El compilador de esta librería necesita integrarse en el proceso de complilado de SvelteKit de tu proyecto. Para ello añadelo a las lista de plugins de vite en tu",
8490
"getting-started.paragraph.hook-into-sveltekit-2": "Y ya está todo listo. Tiempo de usar la librería.",

locales/gl.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@
7979
"getting-started.paragraph.create-translations-2": "no raiz do proxecto, pero en realidade podes colocar o directorio onde prefiras",
8080
"getting-started.paragraph.create-translations-3": "Recomiendo usar ficheiros .json pero podes tamén crear ficheiros javascript que exporten un único obxeto que contén as traduccións. Calqueira que sexa a túa preferencia, as traduccións son simples cadeas coa sintaxis ICU:",
8181
"getting-started.paragraph.create-translations-4": "Eu prefiero o diccionario de traduccións teña un único nivel e usar puntos para crear xerarquías coma o de enriba, pero tamén podes aniñar obxetos coma a continuación:",
82+
"getting-started.paragraph.create-translations-5": "¡JSON é demasido ríxido! ¡Quero máis flexibilidade!",
83+
"getting-started.paragraph.create-translations-6": "Podes usar funcionalidades de JSON 5 nos teus ficheiros json. Por exemplo, podes usar comentarios, strings multi-línea, comillas simples, comas ó final de línas... <br>Funciona automáticamente.",
84+
"getting-started.paragraph.create-translations-7": "Non me gustan as chaves",
85+
"getting-started.paragraph.create-translations-8": "Como vexas. Si che gusta usar espacios puedes tamín utilizar ficheiros YAML. Tan so engade a extensión .yaml ou .yml. Se e que che van esas cousas.",
86+
"getting-started.paragraph.create-translations-9": "Quero máis funcionalidades",
87+
"getting-started.paragraph.create-translations-10": "Podes definir as túas traduccions en ficheiros .js, ficheiros .ts y ficheiros .mjs. O módulo debe exportar un objecto coas traduccións como o seu export por defecto.",
8288
"getting-started.subsection.hook-into-sveltekit": "Acomplar o compilador a SvelteKit",
8389
"getting-started.paragraph.hook-into-sveltekit-1": "O compilador desta librería necesita integrarse no proceso de complilado de SvelteKit do teu proxecto. Para elo engadep a lista de plugins de vite no teu",
8490
"getting-started.paragraph.hook-into-sveltekit-2": "E xa está todo listo. Tempo de usar a librería.",

package-lock.json

Lines changed: 34 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@fontsource/fira-mono": "^4.5.0",
2929
"@lukeed/uuid": "^2.0.0",
3030
"cookie": "^0.4.1",
31-
"svelte-intl-precompile": "^0.7.0",
31+
"svelte-intl-precompile": "^0.8.0",
3232
"terser": "^5.9.0"
3333
}
3434
}

src/routes/[...lang]/docs/configuration.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<Codeblock lang="html">
2424
{`<script context="module">
2525
import { addMessages, init } from 'svelte-intl-precompile';
26-
import en from '$locales/en.js';
27-
import es from '$locales/es.js';
26+
import en from '$locales/en';
27+
import es from '$locales/es';
2828
addMessages('en', en);
2929
addMessages('es', es);
3030
init({
@@ -73,8 +73,8 @@ addMessages('es', es);
7373

7474
<Codeblock lang="js">{`
7575
import { init, register, waitLocale } from 'svelte-intl-precompile';
76-
register('en', () => import('$locales/en.js'));
77-
register('es', () => import('$locales/es.js'));
76+
register('en', () => import('$locales/en'));
77+
register('es', () => import('$locales/es'));
7878
init({ initialLocale: en });
7979
8080
export async function preload() {

src/routes/[...lang]/docs/getting-started.svelte

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,24 @@
6161
}`}
6262
</Codeblock>
6363

64+
<h3 class="text-l font-semibold">{$t('getting-started.paragraph.create-translations-5')}</h3>
65+
66+
<p>{@html $t('getting-started.paragraph.create-translations-6')}</p>
67+
68+
<h3 class="text-l font-semibold">{$t('getting-started.paragraph.create-translations-7')}</h3>
69+
70+
<p>{$t('getting-started.paragraph.create-translations-8')}</p>
71+
72+
<h3 class="text-l font-semibold">{$t('getting-started.paragraph.create-translations-9')}</h3>
73+
74+
<p>{$t('getting-started.paragraph.create-translations-10')}</p>
75+
6476
<h2 class="text-2xl font-semibold">{$t('getting-started.subsection.hook-into-sveltekit')}</h2>
6577

6678
<p>{$t('getting-started.paragraph.hook-into-sveltekit-1')}<CodeInline>/svelte.config.js</CodeInline>.</p>
6779

6880
<Codeblock lang="js">
69-
{`import precompileIntl from "svelte-intl-precompile/sveltekit-plugin.js";
81+
{`import precompileIntl from "svelte-intl-precompile/sveltekit-plugin";
7082
7183
const config = {
7284
kit: {
@@ -91,7 +103,7 @@ export default config;`}
91103
<Codeblock lang="js">
92104
{`import { defineConfig } from "vite";
93105
import { svelte } from "@sveltejs/vite-plugin-svelte";
94-
import precompileIntl from "svelte-intl-precompile/sveltekit-plugin.cjs";
106+
import precompileIntl from "svelte-intl-precompile/sveltekit-plugin";
95107
96108
export default defineConfig({
97109
resolve: {

svelte.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import preprocess from 'svelte-preprocess';
22
import netlify from '@sveltejs/adapter-netlify';
3-
import precompileIntl from "svelte-intl-precompile/sveltekit-plugin.js";
3+
import precompileIntl from "svelte-intl-precompile/sveltekit-plugin";
44

55
/** @type {import('@sveltejs/kit').Config} */
66
const config = {

0 commit comments

Comments
 (0)