Giter VIP home page Giter VIP logo

xliff-conv's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xliff-conv's Issues

Don't force 'state' attribute if no state

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

Successive 2 builds are required to reflect auto-translated-state annotations to JSON and XLIFF

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:

  1. HTML with new strings -> JSON with 'add' todo.op (through leverage) -> export XLIFF with 'new' state -> feedback to src XLIFF
  2. Import XLIFF with 'new' state -> JSON without todo (expression matching) -> XLIFF with 'translated' state for annotations

This behavior is by design for now. Better solution is under investigation.

Add <tool> tag

Add <tool> tag with tool-id, tool-name, tool-version attributes.

Support ES Module

Support ES Module

Import

import XliffConv from 'xliff-conv/esm/xliff-conv.js'; // .js extension
import XliffConv from 'xliff-conv/xliff-conv.mjs'; // .mjs extension

Files

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

Build

# generate esm/xliff-conv.js, xliff-conv.mjs, xliff-conv.js from src/xliff-conv.js
npm run build # (= node build.js)

Customize logger functions

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

Illegal invocation on loggers

Illegal invocation on loggers

this must be console for console.log(), console.warn(), and console.error() functions.

[Enhancement] Support empty value "" to remove attribute

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]' ]
} };

Handy migration from xliff2bundlejson

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.

Support for custom templates

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.