Merges XLIFF 1.2/2.0 files. Usable for Angular i18n automation.

Overview

npm Coverage Status Language grade: JavaScript

XLIFF Simple Merge

This program automates the merging of XLIFF files (version 1.2 and 2.0). New translations from the input file (e.g. "messages.xlf") are merged into the destination file (e.g "messages.fr-FR.xlf"), while keeping exising translations intact. Removed translations will be removed in the input file.

This can be used as post-processing to angular i18n extraction, to update translations files.

Usage

Either install via npm i -g xliff-simple-merge or run directly with npx xliff-simple-merge.

Options:
  -i, --input-file <inputFile>              input file/merge origin
  -d, --destination-file <destinationFile>  merge destination
  -o, --output-file <outputFile>            output file, if not provided "merge destination" is overwritten
  --no-match-fuzzy                          prevent fuzzy matching of similar units with changed id
  --no-collapse-whitespace                  prevent collapsing of multiple whitespaces and trimming when comparing translations sources
  --no-reset-translation-state              prevent (re-)setting the translation state to new/initial for new/changed units
  --no-replace-apostrophe                   prevent replacing of apostrophes (') with "&apos;"
  --debug                                   enable debug output
  -h, --help                                display help for command
Comments
  • Not copying source to target when

    Not copying source to target when "newTranslationTargetsBlank" is true and "sourceLanguage" is also true

    Hi!

    I would like to generate blank target nodes for every locale, but not the one which is the source language. Currently, using the mentioned options together, in the sourceLanguage locale, I get <target state="final"/>, which is, I think, not the desired behavior. An expected result would be (giving that the source language is in English, other locale is German:

    English:

    <trans-unit id="test" datatype="html">
            <source>This is the source code text</source>
            <target state="final">This is the source code text</target>
            <note priority="1" from="description">test</note>
    </trans-unit>
    

    German:

    <trans-unit id="test" datatype="html">
            <source>This is the source code text</source>
            <target state="new"/>
            <note priority="1" from="description">test</note>
    </trans-unit>
    

    If you agree, I could make a pull request with the fix.

    opened by gergely-gyorgy-both 4
  • Prevent replacement of apostrophes with html character entities

    Prevent replacement of apostrophes with html character entities

    Currently, apostrophes ( ' ) in xliff-files in <source> or <target> tags will be replaced by &apos; when running xliff-simple-merge. Is there a way to prevent this behaviour? Thanks in advance

    question 
    opened by vglaeser 4
  • Merge changes to notes

    Merge changes to notes

    It seems like no changes to <note> items are carried over from the source file to the destination file.

    For example, if a trans-unit already exists in the target file and the <note from="description"> for the unit has been updated in the source file, the updated description will not carry over into the destination file.

    It feels like the expected behaviour would be that everything in the <trans-unit> should be updated, except for the <target>.

    bug 
    opened by demilsson 3
  • TypeError: Cannot read properties of undefined (reading 'attr')

    TypeError: Cannot read properties of undefined (reading 'attr')

    xliff-simple-merge --input-file messages.xlf --destination-file messages.de.xlf -output-file output.xlf ...npm\node_modules\xliff-simple-merge\dist\src\merge.js:54 destUnit.childNamed('target').attr.state = 'new'; ^

    TypeError: Cannot read properties of undefined (reading 'attr')

    bug 
    opened by atix9000 3
  • support translation state for xliff 1.2

    support translation state for xliff 1.2

    In XLIFF 1.2 this is the attribute "state" on the element. It usually is "new" for newly added translations or "translated" for actually translated values.

    enhancement 
    opened by daniel-sc 0
Releases(v1.0.2)
  • v1.0.2(Dec 9, 2022)

    • fix: fix target nodes blank when language is source language #9 (#10)

    Thanks @gergely-gyorgy-both for the first contribution!

    https://github.com/daniel-sc/xliff-simple-merge/compare/v1.0.1...v1.0.2

    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Nov 2, 2022)

    • ref: adding semicolon to fix LGTM alert a2980f7
    • Merge pull request #8 from daniel-sc/performance-fix 54be3bd
    • fix: performance for fuzzy matching many elements now acceptable b9336af

    https://github.com/daniel-sc/xliff-simple-merge/compare/v1.0.0...v1.0.1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Oct 21, 2022)

    • feat: sync all non-target nodes to destination file 2b75c13 #6
    • hinting angular users to the optimized tooling ae00f4f

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.12.4...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.4(Jul 20, 2022)

    • fix: do not change translation state for non-updates (changes only in collapsible whitespace) 83f1780

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.12.3...v0.12.4

    Source code(tar.gz)
    Source code(zip)
  • v0.12.3(Jul 18, 2022)

    • fix: fuild / jest dependency 87fefaa
    • fix: gracefully handle non-existent target nodes 5cb1e18

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.12.2...v0.12.3

    Source code(tar.gz)
    Source code(zip)
  • v0.12.2(Jul 1, 2022)

    • fix: gracefully handle non-existent / empty target file 8cbd629

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.12.1...v0.12.2

    Source code(tar.gz)
    Source code(zip)
  • v0.12.1(May 25, 2022)

    • fix: collapseWhitespace must not trim leading/trailing whitespaces 87a07cf

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.12.0...v0.12.1

    Source code(tar.gz)
    Source code(zip)
  • v0.12.0(May 5, 2022)

  • v0.11.1(May 5, 2022)

    • fix: assure fuzzyMatch does not steal units that could have been matched better 95ae654

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.11.0...v0.11.1

    Source code(tar.gz)
    Source code(zip)
  • v0.11.0(Apr 26, 2022)

    • feat: sync (changed) source to target for untranslated units 770e7fe
    • feat: config option to omit new translation target nodes ea6589d

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.10.2...v0.11.0

    Source code(tar.gz)
    Source code(zip)
  • v0.10.2(Apr 11, 2022)

  • v0.10.1(Mar 24, 2022)

    • fix: with option "sourceLanguage" changed texts should update target value ca7f863

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.10.0...v0.10.1

    Source code(tar.gz)
    Source code(zip)
  • v0.10.0(Mar 21, 2022)

    • feat: add option "sourceLanguage" to assign new units state=final ba4b667

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.9.1...v0.10.0

    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Mar 16, 2022)

  • v0.9.0(Mar 16, 2022)

  • v0.8.2(Mar 10, 2022)

  • v0.8.1(Mar 2, 2022)

    • fix: correct dist files including changes for #2
    • refactor: extract method to keep first/last child in sync 3ef8ee2

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.8.0...v0.8.1

    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Jan 28, 2022)

  • v0.7.0(Jan 27, 2022)

    • add configuration to prevent replacement of apostrophes - fixes #4 839d660

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.6.0...v0.7.0

    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Jan 24, 2022)

    • support translation state for xliff 1.2 - fixes #3 09b264b
    • adding MIT license 3826da8

    https://github.com/daniel-sc/xliff-simple-merge/compare/v0.5.0...v0.6.0

    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Jan 21, 2022)

  • v0.4.0(Jan 20, 2022)

  • v0.3.0(Jan 20, 2022)

  • v0.2.0(Jan 20, 2022)

  • v0.1.1(Jan 20, 2022)

  • v0.1.0(Jan 20, 2022)

Owner
Daniel Schreiber
Daniel Schreiber
The alternative internationalization (i18n) library for Angular

NGX Locutus The alternative Angular Translation Library used for large scale microfrontend translations. No more worrying about shared translation ass

Stefan Haas 9 May 31, 2022
human friendly i18n for javascript (node.js + browser)

BabelFish - human friendly i18n for JS Internationalisation with easy syntax for node.js and browser. Classic solutions use multiple phrases for plura

Nodeca 246 Nov 20, 2022
Internationalization for react done right. Using the i18next i18n ecosystem.

react-i18next IMPORTANT: Master Branch is the new v10 using hooks. $ v10.0.0 npm i react-i18next react-native: To use hooks within react-native, you m

i18next 7.9k Dec 30, 2022
ICU MessageFormat for Javascript - i18n Plural and Gender Capable Messages

messageformat The experience and subtlety of your program's text can be important. Messageformat is a mechanism for handling both pluralization and ge

null 1.6k Dec 23, 2022
ICU MessageFormat for Javascript - i18n Plural and Gender Capable Messages

messageformat The experience and subtlety of your program's text can be important. Messageformat is a mechanism for handling both pluralization and ge

null 1.6k Dec 23, 2022
Gettext Style i18n for Modern JavaScript Apps

Jed Gettext Style i18n for Modern JavaScript Apps For more info

null 879 Dec 14, 2022
Type-safe internationalization (i18n) for Next.js

Type-safe internationalization (i18n) for Next.js Features Usage Examples Scoped translations Change current locale Use JSON files instead of TS for l

Tom Lienard 251 Dec 22, 2022
lightweight jQuery plugin for providing internationalization to javascript from ‘.properties’ files

jQuery.i18n.properties About jQuery.i18n.properties is a lightweight jQuery plugin for providing internationalization to javascript from ‘.properties’

null 408 Dec 25, 2022
Extract and merge i18n xliff translation files for angular projects.

Angular extract i18n and merge This extends Angular CLI to improve the i18n extraction and merge workflow. New/removed translations are added/removed

Daniel Schreiber 86 Jan 5, 2023
i18n-language.js is Simple i18n language with Vanilla Javascript

i18n-language.js i18n-language.js is Simple i18n language with Vanilla Javascript Write by Hyun SHIN Demo Page: http://i18n-language.s3-website.ap-nor

Shin Hyun 21 Jul 12, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A new generation GUI automation framework for Web and Desktop Application Testing and Automation.

Clicknium-docs Clicknium is a new generation GUI automation framework for all types of applications. It provides easy and smooth developer experience

null 109 Dec 19, 2022
geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.

geotiff.js Read (geospatial) metadata and raw array data from a wide variety of different (Geo)TIFF files types. Features Currently available function

geotiff.js 649 Dec 21, 2022
This Photoshop script exports all top-level layers and groups to cropped PNG and JPEG files and creates a file usable in Tumult Hype 4 based on your Photoshop document.

Export To Hype (Photoshop Edition) This Photoshop script exports all top-level layers and groups to cropped PNG and JPEG files and creates a file usab

Max Ziebell 6 Nov 9, 2022
The alternative internationalization (i18n) library for Angular

NGX Locutus The alternative Angular Translation Library used for large scale microfrontend translations. No more worrying about shared translation ass

Stefan Haas 9 May 31, 2022
Automation for creating markdown files for 100 Days of Productivity challenge.

Automation for creating markdown files for 100 Days of Productivity challenge. This started as a challenge initially inspired by Alexander Kallaway's

null 16 Nov 18, 2022
This repo contains utility tools for manipulating files, process images and automation.

utility-tools-cli This repo contains utility tools which makes life lil bit easier. Features Rename Files in a Folder with the convention you want. Re

Wasim Raja 4 Nov 4, 2022
:bar_chart: Re-usable, easy interface JavaScript chart library based on D3.js

billboard.js is a re-usable, easy interface JavaScript chart library, based on D3 v4+. The name "billboard" comes from the famous billboard chart whic

NAVER 5.4k Jan 1, 2023