From 5ada5beed32009f18bf27a529d68e9b73c6bfe54 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Wed, 20 Nov 2019 01:32:54 -0300 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20testing=20partial=20loa?= =?UTF-8?q?ding=20and=20merging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierrc | 2 +- example/messages/en.json | 10 ++++++++++ example/src/i18n.js | 11 +++++------ example/src/routes/_layout.svelte | 8 ++++---- example/src/routes/about/index.svelte | 18 +++++++----------- test/client/index.test.ts | 22 ++++++++++++++++------ test/fixtures/en.json | 3 +++ test/fixtures/partials/en.json | 5 +++++ yarn.lock | 5 +++++ 9 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 example/messages/en.json create mode 100644 test/fixtures/partials/en.json diff --git a/.prettierrc b/.prettierrc index 279ffd9..beaab0d 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,7 +1,7 @@ { "semi": false, "printWidth": 100, - "trailingComma": "all", + "trailingComma": "es5", "bracketSpacing": true, "jsxBracketSameLine": false, "singleQuote": true diff --git a/example/messages/en.json b/example/messages/en.json new file mode 100644 index 0000000..fb80aae --- /dev/null +++ b/example/messages/en.json @@ -0,0 +1,10 @@ +{ + "title": { + "index": "Sapper project template!" + }, + "messages": { + "success": "Great success!", + "high_five": "High five", + "try_editing": "Try editing this file (src/routes/index.svelte) to test live reloading." + } +} diff --git a/example/src/i18n.js b/example/src/i18n.js index 6c272fc..d6ebe1e 100644 --- a/example/src/i18n.js +++ b/example/src/i18n.js @@ -1,7 +1,6 @@ -import { dictionary } from 'svelte-i18n' +import { registerLocaleLoader } from 'svelte-i18n' -dictionary.set({ - 'pt-BR': () => import('../messages/pt-BR.json'), - 'en-US': () => import('../messages/en-US.json'), - 'es-ES': () => import('../messages/es-ES.json'), -}) +registerLocaleLoader('en', () => import('../messages/en.json')) +registerLocaleLoader('pt-BR', () => import('../messages/pt-BR.json')) +registerLocaleLoader('en-US', () => import('../messages/en-US.json')) +registerLocaleLoader('es-ES', () => import('../messages/es-ES.json')) diff --git a/example/src/routes/_layout.svelte b/example/src/routes/_layout.svelte index 5d8c826..9234774 100644 --- a/example/src/routes/_layout.svelte +++ b/example/src/routes/_layout.svelte @@ -30,16 +30,16 @@ } - - {loading} - +{loading}