Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Commit

Permalink
doc: introduce gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiocro committed May 9, 2017
1 parent e73fdb4 commit fad2d90
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
node_modules/
dist/
lib/
gh-pages/
npm-debug.log
test/coverage
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ $ npm install @panter/vue-i18next

## Usage

[DEMO](https://panter.github.io/vue-i18next/examples/)

### Init

``` javascript
Expand Down
30 changes: 25 additions & 5 deletions examples/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,22 @@ const locales = {
},
tos: 'Term of Service',
term: 'I accept {{1}} {{0}}.',
loadbundle: 'Load Bundle {{lang}}',
},

de: {
message: {
hello: 'Hallo!! - DE',
},
tos: 'Geschäft',
tos: 'Nutzungsbedingungen',
term: 'Ich akzeptiere {{0}}. {{1}}',
loadbundle: 'Bundle Laden {{lang}}',
},
};

i18next.init({
lng: 'en',
fallbackLng: 'en',
resources: {
en: { translation: locales.en },
},
Expand All @@ -29,9 +32,13 @@ const i18n = new VueI18next(i18next);
Vue.component('app', {
template: `
<div>
<language-changer /><load-bundle />
<p>$t: {{ $t("message.hello") }}</p>
<div>
<h3>Translation</h3>
<language-changer></language-changer><load-bundle></load-bundle>
<p>$t: {{ $t("message.hello") }}</p>
</div>
<div>
<h3>Interpolation</h3>
<i18next path="term" tag="label" for="tos">
<a href="#" target="_blank">{{ $t("tos") }}</a>
<strong>a</strong>
Expand All @@ -41,7 +48,12 @@ Vue.component('app', {
});

Vue.component('language-changer', {
template: '<div><a v-on:click="changeLanguage(\'de\')">DE</a>&nbsp;&nbsp;&nbsp;<a v-on:click="changeLanguage(\'en\')">EN</a></div>',
template: `
<div>
<a v-on:click="changeLanguage('de')">DE</a>
&nbsp;|&nbsp;
<a v-on:click="changeLanguage('en')">EN</a>
</div>`,
methods: {
changeLanguage(lang) {
this.$i18n.i18next.changeLanguage(lang);
Expand All @@ -50,7 +62,15 @@ Vue.component('language-changer', {
});

Vue.component('load-bundle', {
template: '<div><a v-on:click="loadBundle">load de bundle</a></div>',
template: `
<div>
<a v-on:click="loadBundle">{{$t("loadbundle", {lang: this.lang}) }}</a>
</div>`,
data() {
return {
lang: 'DE',
};
},
methods: {
loadBundle() {
this.$i18n.i18next.addResourceBundle('de', 'translation', locales.de);
Expand Down
4 changes: 2 additions & 2 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>vue-i18next Example</title>
<script src="https://unpkg.com/vue@2.2.2/dist/vue.js"></script>
<script src="https://unpkg.com/i18next@8.0.0/i18next.js"></script>
<script src="/dist/vue-i18next.js"></script>
<script src="../dist/vue-i18next.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style media="screen">
body {
Expand All @@ -22,6 +22,6 @@
<div id="app">
<app />
</div>
<script src="/examples/app.js"></script>
<script src="app.js"></script>
</body>
</html>
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"build:lib": "rimraf ./lib && babel src --out-dir lib",
"lint": "eslint src/**.js",
"test": "npm run lint && npm run test:unit",
"test:unit": "cross-env BABEL_ENV=test karma start test/karma.conf.js"
"test:unit": "cross-env BABEL_ENV=test karma start test/karma.conf.js",
"gh-pages": "npm run build && rimraf ./gh-pages && mkdirp ./gh-pages/examples mkdirp ./gh-pages/dist && ncp ./examples ./gh-pages/examples && ncp ./dist ./gh-pages/dist",
"gh-pages-publish": "gh-pages -d gh-pages"
},
"main": "./dist/vue-i18next.js",
"peerDependencies": {
Expand All @@ -51,6 +53,7 @@
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.8.0",
"file-loader": "^0.9.0",
"gh-pages": "^1.0.0",
"i18next": "^6.0.1",
"jasmine": "^2.5.3",
"jasmine-core": "^2.5.2",
Expand All @@ -68,8 +71,10 @@
"karma-sinon-chai": "^1.2.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.2",
"mkdirp": "^0.5.1",
"mocha": "^3.2.0",
"mocha-loader": "^1.1.1",
"ncp": "^2.0.0",
"phantomjs-prebuilt": "^2.1.14",
"rimraf": "^2.6.1",
"sinon": "^2.1.0",
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
historyApiFallback: {
rewrites: [
{ from: /^\/$/, to: '/examples/index.html' },
{ from: 'app.js', to: '/examples/app.js' },
],
},
noInfo: true,
Expand Down
58 changes: 56 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ async@2.0.1:
dependencies:
lodash "^4.8.0"

async@2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4"
dependencies:
lodash "^4.14.0"

async@^2.0.0, async@^2.1.2, async@^2.1.4:
version "2.4.0"
resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611"
Expand Down Expand Up @@ -912,6 +918,10 @@ base64id@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/base64id/-/base64id-1.0.0.tgz#47688cb99bb6804f0e06d3e763b1c32e57d8e6b6"

base64url@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/base64url/-/base64url-2.0.0.tgz#eac16e03ea1438eff9423d69baa36262ed1f70bb"

batch@0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/batch/-/batch-0.5.3.tgz#3f3414f380321743bfc1042f9a83ff1d5824d464"
Expand Down Expand Up @@ -2451,6 +2461,14 @@ fs-access@^1.0.0:
dependencies:
null-check "^1.0.0"

fs-extra@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^3.0.0"
universalify "^0.1.0"

fs-extra@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950"
Expand Down Expand Up @@ -2532,6 +2550,18 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

gh-pages@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/gh-pages/-/gh-pages-1.0.0.tgz#4a46f4c25439f7a2b7e6835504d4a49e949f04ca"
dependencies:
async "2.1.4"
base64url "^2.0.0"
commander "2.9.0"
fs-extra "^3.0.1"
globby "^6.1.0"
graceful-fs "4.1.11"
rimraf "^2.5.4"

glob-base@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
Expand Down Expand Up @@ -2581,7 +2611,17 @@ globby@^5.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

graceful-fs@^4.1.0, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
globby@^6.1.0:
version "6.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c"
dependencies:
array-union "^1.0.1"
glob "^7.0.3"
object-assign "^4.0.1"
pify "^2.0.0"
pinkie-promise "^2.0.0"

graceful-fs@4.1.11, graceful-fs@^4.1.0, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand Down Expand Up @@ -3249,6 +3289,12 @@ jsonfile@^2.1.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonfile@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-3.0.0.tgz#92e7c7444e5ffd5fa32e6a9ae8b85034df8347d0"
optionalDependencies:
graceful-fs "^4.1.6"

jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
Expand Down Expand Up @@ -3782,6 +3828,10 @@ natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"

ncp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"

negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
Expand Down Expand Up @@ -4822,7 +4872,7 @@ right-align@^0.1.1:
dependencies:
align-text "^0.1.1"

rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.0, rimraf@^2.6.1:
rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.5.4, rimraf@^2.6.0, rimraf@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
Expand Down Expand Up @@ -5493,6 +5543,10 @@ uniqs@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02"

universalify@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.0.tgz#9eb1c4651debcc670cc94f1a75762332bb967778"

unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
Expand Down

0 comments on commit fad2d90

Please sign in to comment.