t2ym / xliff-conv Goto Github PK
View Code? Open in Web Editor NEWXLIFF to/from JSON converter for Polymer i18n-behavior
License: Other
XLIFF to/from JSON converter for Polymer i18n-behavior
License: Other
Successive 2 build cycles are required to reflect auto-translated-state annotations to JSON and XLIFF.
Since pattern matching expressions as of 0.0.11 are applied through XLIFF import, JSON todo items for newly added strings are removed, that is, regarded as translated, only after 2 successive build cycles.
Required 2 Successive Build Cycles:
'add' todo.op
(through leverage) -> export XLIFF with 'new' state
-> feedback to src XLIFF'new' state
-> JSON without todo
(expression matching) -> XLIFF with 'translated' state
for annotationsThis behavior is by design for now. Better solution is under investigation.
Support non-string values in todo.value
.
As xliff2bundlejson
is unaware of todo
items in JSON and state
attributes in XLIFF, todo
items are likely to be removed manually or by the finalize
option in gulp-i18n-leverage
.
For xliff-conv
, handy migration from such xliff2bundlejson
configurations has to be provided.
The finalize
option should be enabled only for production builds (without feedback task) and todo
items in JSON files have to be kept intact through development cycles.
Add todoUpdated
stats counter for parseXliff()
The counter is incremented whenever a meta.todo
item is added, removed, or updated.
Support cancelling approval of approved items.
todo
items for unapproved items have to be re-populated.
Greetings,
In our translation system, we store XLIFF files in git and we don't use the 'state' attribute.
To avoid marking the entire file as changed after merging with a JSON, we'd like to be able to skip the 'state' attribute that is currently being forced.
I'm preparing a pull request with this change.
Thank you,
Felipe
Add file attribute values in XLIFF stats
stats.xliff.file = { "source-language": "en", ... }
approved="yes"
attribute is missing when state
attribute defaults to "translated"
due to unknown todo.op
.
_$type$_
prefix is not removed in target strings
Exception is thrown due to Array.contains()
polyfill at _todoOps()
.
for (var i = 0; i < array.length; i++)
should be used instead of for (var i in array)
Default unapproved state has to be 'needs-translation'
.
The state has to be mapped to todo.op 'replace'
.
README state table has to be updated as well.
Add XLIFF statistics on parseJSON()
as its second callback argument
Our translation workflow involves the use of XLIFF-supported tags not present in xliff-conv such as <note/>
. We also don't care much about <header/>
and usually prefer version 1.2 to 1.0.
All those differences can be addressed by supporting custom templates as parameters to parseJSON().
I'm preparing a pull request that adds this support.
Thank you,
Felipe
Exception on missing meta.todo
object.
Illegal invocation on loggers
this
must be console
for console.log()
, console.warn()
, and console.error()
functions.
Support ES Module
import XliffConv from 'xliff-conv/esm/xliff-conv.js'; // .js extension
import XliffConv from 'xliff-conv/xliff-conv.mjs'; // .mjs extension
path | type |
---|---|
xliff-conv/xliff-conv.js | UMD (unchanged) |
xliff-conv/xliff-conv.mjs | ES Module |
xliff-conv/esm/xliff-conv.js | ES Module |
xliff-conv/src/xliff-conv.js | factory function source |
xliff-conv/build.js | build script |
# generate esm/xliff-conv.js, xliff-conv.mjs, xliff-conv.js from src/xliff-conv.js
npm run build # (= node build.js)
_$type$_
prefix is not removed in generated todo items' source strings.
Implement pattern matching expression [value~=pattern]
pattern
can be named, predefined, and customizable.
Customize logger functions.
XliffConv(options)
:
options.logger
- information logger; defaults to console.log
options.warnLogger
- warning logger; defaults to console.warn
options.errorLogger
- error logger; defaults to console.error
Add XLIFF and JSON statistics on parseXliff()
as its second callback argument
Add valueUpdated
stats counter for parseXliff()
The counter is incremented if the new value is different from the old value.
Empty strings in JSON are not updated by XLIFF.
The root cause is the empty strings unexpectedly treated as inexistent in JSON.
Support the special empty value "" to remove attribute
var xliffOptions =
{ xliffStates: {
'add' : [ 'new' ],
'replace': [ 'needs-translation', 'needs-adaptation', 'needs-l10n' ],
'approve' : [ '""', 'needs-review-translation', 'needs-review-adaptation', 'needs-review-l10n',
'[!approved&&state:=""&&approved:=no]' ],
'default': [ '', 'translated', 'signed-off', 'final', '[approved]' ]
} };
Add <tool>
tag with tool-id
, tool-name
, tool-version
attributes.
Put higher priorities in expressions than static XLIFF states instead of matching static XLIFF states first.
With this enhancement, expressions can override existing XLIFF states.
Set attribute values in XLIFF at export.
tag.attribute:=value
Support AMD global exports
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.