Coder Social home page Coder Social logo

gumm / xtbgenerator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kuzmisin/xtbgenerator

0.0 3.0 0.0 40.85 MB

Generate/append XTB (translation XML file) for google closure compiler https://developers.google.com/closure/compiler/

Java 97.47% JavaScript 2.53%

xtbgenerator's Introduction

XtbGenerator

Now with support for EcmaScript 6 and up.

Generate/append XTB (translation XML file) for google closure compiler https://developers.google.com/closure/compiler/

XTB file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE translationbundle>
<translationbundle lang="cs">
    <translation id="1234567890">Message ...</translation>
    <translation id="1234567891">Message with <ph name="PLACE_HOLDER" />.</translation>
    ...
</translationbundle>

JS file

/** @desc Description for Test 1 */
var MSG_TEST_1 = goog.getMsg('Test 1');

/** @desc Message with placeholder */
var MSG_TEST_2 = goog.getMsg('Message with {$placeHolder}.', {placeHolder: 'replaced text'});

Usage

Usage: XtbGenerator --lang <arg> [--projectId <arg>] --js <FILE1> [--js <FILE2>]
or: XtbGenerator --lang <arg> [--projectId <arg>] FILE1 [FILE2]

Params:
    --lang          : Lang
    --projectId     : Project ID
    --js            : Input JS file, possibly with * or ** wildcards for glob search
    --translations_file : XTB translation file
    --xtb_output_file   : XTB output file

Stand alone usage

Create message file

java -jar XtbGenerator.jar \
	--lang cs \
	--xtb_output_file messages.xtb \
	--js messages.js

Append to existing message file

java -jar XtbGenerator.jar \
	--lang cs \
	--translations_file messages.xtb \
	--xtb_output_file messages.xtb \
	--js messages.js

You may also use minimatch-style glob patterns for input files. For example, use --js='**.js' --js='!**_test.js' to recursively include all js files that do not end in _test.js

Usage with closurebuilder.py

closurebuilder.py \
	--root js/ \
	--root js-closure/ \
	--input js/app.js \
	--output_mode=compiled \
	--compiler_jar=XtbGenerator.jar \
	--jvm_flags="-d64" \
	--compiler_flags="--translations_file=messages.xtb" \
	--compiler_flags="--xtb_output_file=messages.xtb" \
	--compiler_flags="--lang=cs"

You can find more about using closurebuilder.py on http://www.closurecheatsheet.com/skeleton

Google closure

More about google closure:

Download

https://raw.github.com/kuzmisin/xtbgenerator/master/bin/XtbGenerator.jar

TODO

  • add meaning into XTB file (depend on visibility of JsMessage.java::getMeaning)

xtbgenerator's People

Contributors

kuzmisin avatar oujesky avatar mattskala avatar

Watchers

James Cloos avatar Jan Badenhorst avatar  avatar

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.