skolmer / i18n-tag-schema Goto Github PK
View Code? Open in Web Editor NEWGenerates a json schema for all i18n tagged template literals in your project
Home Page: http://i18n-tag.kolmer.net
License: MIT License
Generates a json schema for all i18n tagged template literals in your project
Home Page: http://i18n-tag.kolmer.net
License: MIT License
i18n-tag-schema ./src
generates a required value for every occurrence, not only once.
i.e. using { i18n
Start }
three times in the project generates "required": ["Start","Start","Start"]
and this throws an npm error Error: schema is invalid: data.required should NOT have duplicate items
15.13.11
to 15.13.12
.This version is covered by your current version range and after updating it in your project the build failed.
semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 1 commits.
6f3c21a
fix(package): update resolve-from to version 5.0.0
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
i18n(__translationGroup)`test` // not working
i18nGroup(__translationGroup)(App) // working
//...
this.i18n`test`
A working preprocessor is already implemented in the next branch.
TODO:
The test coverage is pretty low at the moment. This needs to be improved.
I was running into an issue using TypeScript 3.7 with optional chaining and React Fragments using empty tags (<>...</>
). In order to get both working properly the TypeScript preprocessor needs some minimal changes:
diff --git a/node_modules/i18n-tag-schema/dist/lib/preprocessors/typescript.js b/node_modules/i18n-tag-schema/dist/lib/preprocessors/typescript.js
index 0e5cd94..60923e3 100644
--- a/node_modules/i18n-tag-schema/dist/lib/preprocessors/typescript.js
+++ b/node_modules/i18n-tag-schema/dist/lib/preprocessors/typescript.js
@@ -15,8 +15,8 @@ exports.default = function (contents, filePath) {
if (!ts) throw new Error('cannot find typescript compiler. check if \'typescript\' node module is installed.');
var processed = ts.transpileModule(contents, {
compilerOptions: {
- target: ts.ScriptTarget.Latest,
- jsx: path.extname(filePath) !== '.ts' ? ts.JsxEmit.Preserve : ts.JsxEmit.None
+ target: ts.ScriptTarget.ES2020,
+ jsx: path.extname(filePath) !== '.ts' ? ts.JsxEmit.React : ts.JsxEmit.None
}
});
if (processed && processed.outputText) {
By setting ES2020
we force transpiling optional chaining syntax (such as foo?.bar
and foo ?? bar
). ts.JsxEmit.React
is needed for proper fragment support.
Custom translations groups should be added to the schema.
i18n('my custom group')`my fancy string`
shoud be validated as:
"my custom group": {
"my fancy string": "some translation"
}
and
@i18nGroup('my custom group')
class App {
getFancyString() {
return this.i18n`my fancy string`
}
getCommonString() {
return i18n('common')`my fancy string`
}
}
shoud be validated as:
"my custom group": {
"my fancy string": "some translation"
},
"common": {
"my fancy string": "some other translation"
}
5.0.7
to 5.0.8
.This version is covered by your current version range and after updating it in your project the build failed.
travis-deploy-once is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 3 commits.
4697ad5
fix: fix babel-register config when module is globally installed
8105e60
chore(package): update nock to version 10.0.0
43b48a3
chore(package): update xo to version 0.23.0
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi, fantastic work! would you consider supporting typescript? Currently it requires only JS files. Thanks!
Replace crlf
with lf
line endings for crossplatform translation support
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
package.json
files, so that was left aloneIf you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
TODO
When calling transpileModule
on a plain .ts
file, with certain generic expressions and when jsx
is set to ts.JsxEmit.Preserve
, incorrect JS will be emitted. For example:
const ts = require('typescript');
const contents = `
const something = <T>(a: T) => {
}
`;
const processed = ts.transpileModule(contents, {
compilerOptions: {
target: ts.ScriptTarget.Latest,
jsx: ts.JsxEmit.Preserve
}
});
console.log(processed.outputText);
will emit:
const something = <T>(a: T) =>
</>;
Which will cause errors when Babylon tries to parse it.
Branch | Build failing 🚨 |
---|---|
Dependency | ajv |
Current Version | 5.1.5 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
ajv is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 8 commits.
ff9f93a
5.1.6
0d6ae42
fix: traverse only schema objects, fixes #521
daf7d6b
docs: using with draft-04
9f0b563
Merge pull request #508 from epoberezkin/greenkeeper/nyc-11.0.2
55727d9
test: remove node v0.12, v5, add v8 to travis test
eac5902
chore(package): update nyc to version 11.0.2
f1c9f15
Merge pull request #507 from epoberezkin/greenkeeper/chai-4.0.1
d74a381
chore(package): update chai to version 4.0.1
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
exported vaidateSchema function fails if the schema contains multiline template literal
related: ajv-validator/ajv#226
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.