From 6fe6c8cca81e61f90f34649385883aca24c86d6d Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Wed, 20 Nov 2019 22:24:29 -0300 Subject: [PATCH] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20initial=20wiki=20d?= =?UTF-8?q?ocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 ++ docs | 1 + example/rollup.config.js | 26 ++++++-------- example/src/i18n.js | 2 +- example/src/routes/_layout.svelte | 51 +++++++++++++++++++-------- example/src/routes/about/index.svelte | 8 ++--- 6 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 .gitmodules create mode 160000 docs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5d76993 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs"] + path = docs + url = git@github.com:kaisermann/svelte-i18n.wiki.git diff --git a/docs b/docs new file mode 160000 index 0000000..acadff6 --- /dev/null +++ b/docs @@ -0,0 +1 @@ +Subproject commit acadff6027a315e011a7157ae3b139d5e4cc3ae5 diff --git a/example/rollup.config.js b/example/rollup.config.js index 2ee80ca..29cd491 100644 --- a/example/rollup.config.js +++ b/example/rollup.config.js @@ -39,28 +39,19 @@ export default { dedupe, }), commonjs(), - json(), + json({ + namedExports: false, + compact: !dev, + }), legacy && babel({ extensions: ['.js', '.mjs', '.html', '.svelte'], runtimeHelpers: true, exclude: ['node_modules/@babel/**'], - presets: [ - [ - '@babel/preset-env', - { - targets: '> 0.25%, not dead', - }, - ], - ], + presets: [['@babel/preset-env', { targets: '> 0.25%, not dead' }]], plugins: [ '@babel/plugin-syntax-dynamic-import', - [ - '@babel/plugin-transform-runtime', - { - useESModules: true, - }, - ], + ['@babel/plugin-transform-runtime', { useESModules: true }], ], }), @@ -88,7 +79,10 @@ export default { dedupe, }), commonjs(), - json(), + json({ + namedExports: false, + compact: !dev, + }), ], external: Object.keys(pkg.dependencies).concat( require('module').builtinModules || diff --git a/example/src/i18n.js b/example/src/i18n.js index 87da174..76dd0a3 100644 --- a/example/src/i18n.js +++ b/example/src/i18n.js @@ -1,4 +1,4 @@ -import { register, getClientLocale, locale } from 'svelte-i18n' +import { register } from 'svelte-i18n' register('en', () => import('../messages/en.json')) register('pt-BR', () => import('../messages/pt-BR.json')) diff --git a/example/src/routes/_layout.svelte b/example/src/routes/_layout.svelte index 649fa7f..bc89961 100644 --- a/example/src/routes/_layout.svelte +++ b/example/src/routes/_layout.svelte @@ -1,10 +1,10 @@ @@ -15,9 +15,9 @@ - {$_('title.about', { default: 'About' })} + {$_('title.about')} -

{$_('about_this_site', { default: 'About this site' })}

+

{$_('about_this_site')}

-

{$_('about_content[0]', { default: "This is the 'about' page. There's not much here." })}

+

{$_('about_content[0]')}