tada: Initial commit
This commit is contained in:
parent
7c28c3b198
commit
99d65d546d
18 changed files with 5143 additions and 3 deletions
3
packages/plugin-i18n/.babelrc
Normal file
3
packages/plugin-i18n/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"plugins": ["transform-object-rest-spread"]
|
||||
}
|
13
packages/plugin-i18n/.editorconfig
Normal file
13
packages/plugin-i18n/.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
63
packages/plugin-i18n/.gitignore
vendored
Normal file
63
packages/plugin-i18n/.gitignore
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Don't include build
|
||||
dist
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# next.js build output
|
||||
.next
|
4
packages/plugin-i18n/.npmignore
Normal file
4
packages/plugin-i18n/.npmignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
src
|
||||
.editorconfig
|
||||
rollup.browser.js
|
||||
rollup.node.js
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 freesewing
|
||||
Copyright (c) 2018 Joost De Cock <joost@decock.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,2 +1,65 @@
|
|||
# plugin-i18n
|
||||
A freesewing plugin for pattern translation
|
||||
<p align="center">
|
||||
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
|
||||
</p>
|
||||
<h4 align="center"><em> <a title="Go to freesewing.org" href="https://freesewing.org/">freesewing</a></em>
|
||||
<br><sup>a library for made-to-measure sewing patterns</sup>
|
||||
</h4>
|
||||
|
||||
# plugin-theme
|
||||
|
||||
A freesewing plugin to provide styles for freesewing. This plugin also provides the `notch` snippet.
|
||||
|
||||
## Usage
|
||||
|
||||
To load this plugin, add it to your instantiated pattern.
|
||||
|
||||
On node.js:
|
||||
|
||||
```js
|
||||
import pattern from '@freesewing/pattern-brian'
|
||||
import theme from '@freesewing/plugin-theme'
|
||||
|
||||
pattern.with(theme);
|
||||
```
|
||||
|
||||
In the browser, this plugin will register as `freesewing.plugins.theme`:
|
||||
|
||||
```html
|
||||
<script type="text/javascript" src="https://unpkg.com/freesewing"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/@freesewing/pattern-brian"></script>
|
||||
<script type="text/javascript" src="https://unpkg.com/@freesewing/plugin-theme"></script>
|
||||
|
||||
<script>
|
||||
var pattern = freesewing.patterns.brian
|
||||
.with(freesewing.plugins.theme);
|
||||
</script>
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
This plugin adds the following CSS classes to your SVG file:
|
||||
|
||||

|
||||
|
||||
In addition, it adds the `notch` and `bnotch` snippets to your SVG file's defs section.
|
||||
|
||||
## Install
|
||||
|
||||
To install, run:
|
||||
|
||||
```sh
|
||||
npm install @freesewing/plugin-theme
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
To build this plugin, run:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
## License: MIT
|
||||
|
||||
See [the license file](https://github.com/freesewing/plugin-theme/blob/master/LICENSE)
|
||||
for details.
|
||||
|
|
BIN
packages/plugin-i18n/img/example.png
Normal file
BIN
packages/plugin-i18n/img/example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
13
packages/plugin-i18n/locales/index.js
Normal file
13
packages/plugin-i18n/locales/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
import patterns from './patterns';
|
||||
import plugins from './plugins';
|
||||
|
||||
export default {
|
||||
en: {
|
||||
...patterns.en,
|
||||
...plugins.en
|
||||
},
|
||||
nl: {
|
||||
...patterns.nl,
|
||||
...plugins.nl
|
||||
}
|
||||
};
|
10
packages/plugin-i18n/locales/patterns.js
Normal file
10
packages/plugin-i18n/locales/patterns.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import brian from "./patterns/brian";
|
||||
|
||||
export default {
|
||||
en: {
|
||||
...brian.en,
|
||||
},
|
||||
nl: {
|
||||
...brian.nl,
|
||||
}
|
||||
};
|
12
packages/plugin-i18n/locales/patterns/brian.js
Normal file
12
packages/plugin-i18n/locales/patterns/brian.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
export default {
|
||||
en: {
|
||||
front: 'Front',
|
||||
back: 'Back',
|
||||
sleeve: 'Sleeve'
|
||||
},
|
||||
nl: {
|
||||
front: 'Voorzijde',
|
||||
back: 'Rug',
|
||||
sleeve: 'Mouw'
|
||||
}
|
||||
}
|
16
packages/plugin-i18n/locales/plugins.js
Normal file
16
packages/plugin-i18n/locales/plugins.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import scalebox from "./plugins/scalebox";
|
||||
import cutonfold from "./plugins/cutonfold";
|
||||
import grainline from "./plugins/grainline";
|
||||
|
||||
export default {
|
||||
en: {
|
||||
...scalebox.en,
|
||||
...cutonfold.en,
|
||||
...grainline.en
|
||||
},
|
||||
nl: {
|
||||
...scalebox.nl,
|
||||
...cutonfold.nl,
|
||||
...grainline.nl
|
||||
}
|
||||
};
|
10
packages/plugin-i18n/locales/plugins/cutonfold.js
Normal file
10
packages/plugin-i18n/locales/plugins/cutonfold.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
export default {
|
||||
en: {
|
||||
cutOnFold: 'Cut on fold',
|
||||
cutOnFoldAndGrainline: 'Cut on fold / Grainline',
|
||||
},
|
||||
nl: {
|
||||
cutOnFold: 'Knippen op de stofvouw',
|
||||
cutOnFoldAndGrainline: 'Knippen op de stofvouw / Draadrichtinge',
|
||||
}
|
||||
}
|
8
packages/plugin-i18n/locales/plugins/grainline.js
Normal file
8
packages/plugin-i18n/locales/plugins/grainline.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
export default {
|
||||
en: {
|
||||
grainline: 'Grainline'
|
||||
},
|
||||
nl: {
|
||||
grainline: 'Draadrichting'
|
||||
}
|
||||
}
|
14
packages/plugin-i18n/locales/plugins/scalebox.js
Normal file
14
packages/plugin-i18n/locales/plugins/scalebox.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
export default {
|
||||
en: {
|
||||
freesewingIsMadeByJoostDeCockAndContributors: "Freesewing is made by Joost De Cock & contributors",
|
||||
withTheFinancialSupportOfOurPatrons: "with the financial support of our patrons",
|
||||
theWhiteInsideOfThisBoxShouldMeasure: "The (white) inside of this box should measure",
|
||||
theBlackOutsideOfThisBoxShouldMeasure: "The (blac) outside of this box should measure"
|
||||
},
|
||||
nl: {
|
||||
freesewingIsMadeByJoostDeCockAndContributors: "Freesewing is gemaakt door Joost De Cock & medewerkers",
|
||||
withTheFinancialSupportOfOurPatrons: "met de financiële steun van onze sponsors",
|
||||
theWhiteInsideOfThisBoxShouldMeasure: "De (witte) binnenkant van dit kader heeft als afmetingen",
|
||||
theBlackOutsideOfThisBoxShouldMeasure: "De (zwarte) buitenkant van dit kader heeft als afmetingen"
|
||||
}
|
||||
}
|
4799
packages/plugin-i18n/package-lock.json
generated
Normal file
4799
packages/plugin-i18n/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
71
packages/plugin-i18n/package.json
Normal file
71
packages/plugin-i18n/package.json
Normal file
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "@freesewing/plugin-i18n",
|
||||
"version": "0.0.1",
|
||||
"description": "A freesewing plugin for pattern translation",
|
||||
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/freesewing/plugin-i18n#readme",
|
||||
"repository": "github:freesewing/plugin-i18n",
|
||||
"bugs": {
|
||||
"url": "https://github.com/freesewing/plugin-i18n/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"freesewing",
|
||||
"plugin",
|
||||
"i18n",
|
||||
"sewing",
|
||||
"patterns"
|
||||
],
|
||||
"main": "dist/index.js",
|
||||
"unpkg": "dist/browser.js",
|
||||
"module": "dist/index.mjs",
|
||||
"scripts": {
|
||||
"patch": "npm version patch -m ':bookmark: v%s' && npm run build",
|
||||
"minor": "npm version minor -m ':bookmark: v%s' && npm run build",
|
||||
"major": "npm version major -m ':bookmark: v%s' && npm run build",
|
||||
"precommit": "npm run pretty && lint-staged",
|
||||
"test": "echo 'Error: no test specified' && exit 1",
|
||||
"clean": "rimraf dist",
|
||||
"pretty": "npx prettier --write 'src/*.js'",
|
||||
"lint": "eslint --fix 'src/*.js'",
|
||||
"browserbuild": "rollup -c rollup.js --file dist/browser.js --format iife --name freesewing.plugins.i18n",
|
||||
"nodebuild": "rollup -c rollup.js --file dist/index.js --format cjs",
|
||||
"modulebuild": "rollup -c rollup.js --file dist/index.mjs --format es",
|
||||
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||
"eslint": "^5.2.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-prettier": "^2.6.2",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^7.2.0",
|
||||
"prettier": "^1.13.7",
|
||||
"rimraf": "^2.6.2",
|
||||
"rollup-plugin-babel": "^3.0.7",
|
||||
"rollup-plugin-commonjs": "^9.1.3",
|
||||
"rollup-plugin-filesize": "^4.0.1",
|
||||
"rollup-plugin-json": "^3.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.3.0",
|
||||
"rollup-plugin-terser": "^1.0.1"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"README.md",
|
||||
"package-lock.json",
|
||||
"package.json"
|
||||
]
|
||||
}
|
23
packages/plugin-i18n/rollup.js
Normal file
23
packages/plugin-i18n/rollup.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { terser } from "rollup-plugin-terser";
|
||||
import babel from "rollup-plugin-babel";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import json from "rollup-plugin-json";
|
||||
import { version, name, description, author, license } from "./package.json";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
plugins: [
|
||||
resolve({
|
||||
browser: true
|
||||
}),
|
||||
json(),
|
||||
babel({
|
||||
exclude: "node_modules/**"
|
||||
}),
|
||||
terser({
|
||||
output: {
|
||||
preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
18
packages/plugin-i18n/src/index.js
Normal file
18
packages/plugin-i18n/src/index.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { version, name } from "../package.json";
|
||||
import locales from "../locales";
|
||||
|
||||
export default {
|
||||
name: name,
|
||||
version: version,
|
||||
hooks: {
|
||||
preRender: function(next) {
|
||||
this.attributes.add("freesewing:plugin-i18n", version);
|
||||
next();
|
||||
},
|
||||
insertText: function(next) {
|
||||
if(typeof locales[this.pattern.settings.locale][this.text] === 'string')
|
||||
this.text = locales[this.pattern.settings.locale][this.text];
|
||||
next();
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue