mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-11 19:24:07 +02:00
first zh-CN locale content
This commit is contained in:
88
article.zh-CN.js
Normal file
88
article.zh-CN.js
Normal file
File diff suppressed because one or more lines are too long
@@ -182,7 +182,7 @@ Deriving the two segments upon splitting a curve takes a few steps, and the high
|
||||
\end{bmatrix}
|
||||
\cdot
|
||||
M
|
||||
\underset{...to\ get\ \ this!}{\underbrace{ \kern 1.25em \cdot \kern 1.25em Q \kern 1.25em \cdot \kern 1.25em}}
|
||||
\underset{...to\ get\ this!}{\underbrace{ \kern 1.25em \cdot \kern 1.25em Q \kern 1.25em \cdot \kern 1.25em}}
|
||||
\begin{bmatrix}
|
||||
P_1 \\ P_2 \\ P_3
|
||||
\end{bmatrix}
|
||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 9.1 KiB |
15
index.html
15
index.html
@@ -210,9 +210,18 @@
|
||||
|
||||
<!-- the actual article is a JS bundle -->
|
||||
<script>
|
||||
var s = document.createElement("script");
|
||||
s.src = "article.js?ts=" + Date.now();
|
||||
document.head.appendChild(s);
|
||||
(function() {
|
||||
var lang = window.location.search;
|
||||
var ms = '?locale=';
|
||||
var lpos = lang.indexOf(ms);
|
||||
var linfix = '';
|
||||
if (lpos !== -1) {
|
||||
linfix = "." + lang.substring(lpos + ms.length);
|
||||
}
|
||||
var s = document.createElement("script");
|
||||
s.src = "article" + linfix+ ".js?ts=" + Date.now();
|
||||
document.head.appendChild(s);
|
||||
}());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
var enData = require('../locales/en-GB/content.js');
|
||||
var enData = require("LocalizedContent");
|
||||
|
||||
var Locale = function(locale) {
|
||||
this.data = {};
|
||||
|
@@ -4,6 +4,7 @@ var SectionHeader = require("../../components/SectionHeader.jsx");
|
||||
|
||||
module.exports = {
|
||||
"preface": {
|
||||
"locale": "en-GB",
|
||||
"title": "Preface",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="preface" title="Preface"/>
|
||||
@@ -29,6 +30,7 @@ module.exports = {
|
||||
|
||||
},
|
||||
"introduction": {
|
||||
"locale": "en-GB",
|
||||
"title": "A lightning introduction",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="introduction" title="A lightning introduction" number="1"/>
|
||||
@@ -43,6 +45,7 @@ module.exports = {
|
||||
|
||||
},
|
||||
"whatis": {
|
||||
"locale": "en-GB",
|
||||
"title": "So what makes a Bézier Curve?",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="whatis" title="So what makes a Bézier Curve?" number="2"/>
|
||||
@@ -69,6 +72,7 @@ Given \left (
|
||||
|
||||
},
|
||||
"explanation": {
|
||||
"locale": "en-GB",
|
||||
"title": "The mathematics of Bézier curves",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="explanation" title="The mathematics of Bézier curves" number="3"/>
|
||||
@@ -210,6 +214,7 @@ function Bezier(3,t):
|
||||
|
||||
},
|
||||
"control": {
|
||||
"locale": "en-GB",
|
||||
"title": "Controlling Bézier curvatures",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="control" title="Controlling Bézier curvatures" number="4"/>
|
||||
@@ -275,6 +280,7 @@ function Bezier(3,t,w[]):
|
||||
|
||||
},
|
||||
"extended": {
|
||||
"locale": "en-GB",
|
||||
"title": "The Bézier interval [0,1]",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="extended" title="The Bézier interval [0,1]" number="5"/>
|
||||
@@ -300,6 +306,7 @@ function Bezier(3,t,w[]):
|
||||
|
||||
},
|
||||
"matrix": {
|
||||
"locale": "en-GB",
|
||||
"title": "Bézier curvatures as matrix operations",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="matrix" title="Bézier curvatures as matrix operations" number="6"/>
|
||||
@@ -414,6 +421,7 @@ function Bezier(3,t,w[]):
|
||||
|
||||
},
|
||||
"decasteljau": {
|
||||
"locale": "en-GB",
|
||||
"title": "de Casteljau's algorithm",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="decasteljau" title="de Casteljau's algorithm" number="7"/>
|
||||
@@ -462,6 +470,7 @@ function Bezier(3,t,w[]):
|
||||
|
||||
},
|
||||
"flattening": {
|
||||
"locale": "en-GB",
|
||||
"title": "Simplified drawing",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="flattening" title="Simplified drawing" number="8"/>
|
||||
@@ -497,6 +506,7 @@ function Bezier(3,t,w[]):
|
||||
|
||||
},
|
||||
"splitting": {
|
||||
"locale": "en-GB",
|
||||
"title": "Splitting curves",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="splitting" title="Splitting curves" number="9"/>
|
||||
@@ -530,6 +540,7 @@ function drawCurve(points[], t):
|
||||
|
||||
},
|
||||
"matrixsplit": {
|
||||
"locale": "en-GB",
|
||||
"title": "Splitting curves using matrices",
|
||||
"getContent": function(handler) { return <section>
|
||||
<SectionHeader name="matrixsplit" title="Splitting curves using matrices" number="10"/>
|
||||
@@ -709,7 +720,7 @@ function drawCurve(points[], t):
|
||||
\end{bmatrix}
|
||||
\cdot
|
||||
M
|
||||
\underset{...to\ get\ \ this!}{\underbrace{ \kern 1.25em \cdot \kern 1.25em Q \kern 1.25em \cdot \kern 1.25em}}
|
||||
\underset{...to\ get\ this!}{\underbrace{ \kern 1.25em \cdot \kern 1.25em Q \kern 1.25em \cdot \kern 1.25em}}
|
||||
\begin{bmatrix}
|
||||
P_1 \\ P_2 \\ P_3
|
||||
\end{bmatrix}
|
||||
@@ -1092,180 +1103,210 @@ function drawCurve(points[], t):
|
||||
|
||||
},
|
||||
"reordering": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (reordering)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"derivatives": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (derivatives)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"pointvectors": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (pointvectors)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"components": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (components)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"extremities": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (extremities)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"boundingbox": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (boundingbox)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"aligning": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (aligning)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"tightbounds": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (tightbounds)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"inflections": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (inflections)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"canonical": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (canonical)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"arclength": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (arclength)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"arclengthapprox": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (arclengthapprox)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"tracing": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (tracing)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"intersections": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (intersections)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"curveintersection": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (curveintersection)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"abc": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (abc)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"moulding": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (moulding)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"pointcurves": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (pointcurves)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"catmullconv": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (catmullconv)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"catmullmoulding": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (catmullmoulding)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"polybezier": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (polybezier)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"shapes": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (shapes)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"projections": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (projections)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"offsetting": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (offsetting)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"graduatedoffset": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (graduatedoffset)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"circles": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (circles)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"circles_cubic": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (circles_cubic)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"arcapproximation": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (arcapproximation)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"bsplines": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (bsplines)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
||||
},
|
||||
"comments": {
|
||||
"locale": "en-GB",
|
||||
"title": "Unknown title (comments)",
|
||||
"getContent": function(handler) { return <section>
|
||||
</section>; }
|
||||
|
1316
locales/zh-CN/content.js
Normal file
1316
locales/zh-CN/content.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,10 @@ var marked = require("marked");
|
||||
var fs = require("fs-extra");
|
||||
|
||||
// bundle all content in a specific locale for use by the app
|
||||
var locale = process.env.locale || "en-GB";
|
||||
const defaultLocale = "en-GB";
|
||||
var locale = defaultLocale;
|
||||
var lpos = process.argv.indexOf('--locale');
|
||||
if (lpos !== -1) { locale = process.argv[lpos+1]; }
|
||||
|
||||
// shim nodejs so that it knows what to do with jsx files: return empty objects.
|
||||
var Module = require('module');
|
||||
@@ -154,7 +157,17 @@ var index = require("./components/sections");
|
||||
var sections = Object.keys(index);
|
||||
var content = {};
|
||||
sections.forEach((cname, number) => {
|
||||
var loc = `./components/sections/${cname}/content.${locale}.md`;
|
||||
|
||||
// Grab locale file, or defaultLocale file if the chosen locale has
|
||||
// has no translated content (yet)...
|
||||
var localeCode = locale;
|
||||
var loc = `./components/sections/${cname}/content.${localeCode}.md`;
|
||||
if (!fs.existsSync(loc)) {
|
||||
localeCode = defaultLocale;
|
||||
loc = `./components/sections/${cname}/content.${localeCode}.md`;
|
||||
}
|
||||
|
||||
// Read in the content.{lang}.md file
|
||||
var data, title;
|
||||
try {
|
||||
data = fs.readFileSync(loc).toString();
|
||||
@@ -171,7 +184,7 @@ sections.forEach((cname, number) => {
|
||||
.replace(/'/g, "'")
|
||||
.replace(/"/g, '"')
|
||||
|
||||
// ``` conversion does odd things
|
||||
// ``` conversion does odd things with <code> tags inside <pre> tags.
|
||||
d = d.replace(/<pre>(\r?\n)*<code>/g,'<pre>')
|
||||
.replace(/<\/code>(\r?\n)*<\/pre>/g,'</pre>');
|
||||
|
||||
@@ -183,12 +196,10 @@ sections.forEach((cname, number) => {
|
||||
|
||||
return d;
|
||||
}).join('');
|
||||
} catch (e) {
|
||||
data = '';
|
||||
title = `Unknown title (${cname})`;
|
||||
}
|
||||
} catch (e) { data = ''; title = `Unknown title (${cname})`; }
|
||||
|
||||
content[cname] = {
|
||||
locale: localeCode,
|
||||
title: title,
|
||||
getContent: "<section>" + data + "</section>"
|
||||
};
|
||||
|
@@ -5,7 +5,11 @@
|
||||
"scripts": {
|
||||
"localize": "node make-locales",
|
||||
"build": "npm run localize && npm run less && webpack -p",
|
||||
"build:zh-CN": "npm run localize && npm run less && cross-env LOCALE=zh-CN webpack -p",
|
||||
|
||||
"dev": "npm run localize && npm run less && webpack-dev-server --progress --colors --hot --inline",
|
||||
"dev:zh-CN": "npm run localize && npm run less && cross-env LOCALE=zh-CN webpack-dev-server --progress --colors --hot --inline",
|
||||
|
||||
"latex": "node tools/mathjax",
|
||||
"less": "lessc stylesheets/style.less > stylesheets/style.css",
|
||||
"singles": "npm run dev -- --singles",
|
||||
@@ -39,6 +43,7 @@
|
||||
"bezier-js": "^2.0.0",
|
||||
"block-loader": "^2.0.0",
|
||||
"chroma-js": "^1.1.1",
|
||||
"cross-env": "^3.1.4",
|
||||
"css-loader": "^0.23.0",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-loader": "^1.6.0",
|
||||
|
@@ -2,6 +2,11 @@ var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
const defaultLocale = "en-GB";
|
||||
var locale = process.env.locale || defaultLocale;
|
||||
|
||||
console.log("Using locale: "+locale);
|
||||
|
||||
// Bundle entry point
|
||||
var entry = ['./components/App.jsx'];
|
||||
|
||||
@@ -24,13 +29,29 @@ var webpackLoaders = [
|
||||
__dirname + '/lib/textarea-loader'
|
||||
];
|
||||
|
||||
console.log("content for entry:", entry);
|
||||
var resolve = {
|
||||
alias: {
|
||||
LocalizedContent: path.resolve(__dirname, 'locales/en-GB/content.js')
|
||||
}
|
||||
};
|
||||
|
||||
// switch the locales
|
||||
if (locale !== defaultLocale) {
|
||||
resolve = {
|
||||
alias: {
|
||||
LocalizedContent: path.resolve(__dirname, 'locales/' + locale + '/content.js')
|
||||
}
|
||||
};
|
||||
output.filename = 'article.' + locale + '.js';
|
||||
console.log("using " + resolve.alias.LocalizedContent + " for output " + output.filename);
|
||||
}
|
||||
|
||||
// And the final config that webpack will read in.
|
||||
module.exports = {
|
||||
entry: entry,
|
||||
target: target,
|
||||
output: output,
|
||||
resolve: resolve,
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user