shershen08 / autotranslate-ng

This application automatically replaces text in HTML tags to angular-translate attributes, and creates translation table.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

npm install -g autotranslate-ng

Introduction

This application automatically replaces text in HTML tags to angular-translate attributes, and creates translation table.

Example

Source HTML:

<h2>Top {{ array.length }} of {{some.count}} users for Today</h2>
<a href="/next">Next</a>

Result HTML:

<h2 translate="top_of_users_for_today" translate-values="REPLACE_45 {{ array.length }}::{{some.count}}"></h2>
<a href="/next" translate="next"></a>

Translation table(JSON):

{
  "top_of_users_for_today": "REPLACE_45 Top {{ array.length }} of {{ some.count }} users for Today",
  "next": "Next",
}

From above example you can also notice that autotranslate-ng also introduces translate-values attributes for angular bindings if they exists in a tag's text. Unfortunately you need to manually convert bindings, automatic conversion is not supported.

Call options

  1. html source path String
  2. label prefix in JSON file String
  3. tag/tag.class to exclude String
  4. Replace initial .html file Boolean

Example: autotranslate-ng client\app\components\account-information.html account-information table true

Usage

$ autotranslate-ng [path_to_file.html]

Result will be placed into current folder as:

  1. filename_translation.html - original HTML file with text replaced to angular-translate attributes
  2. filename_translation.json - translation table in JSON format

Enjoy

About

This application automatically replaces text in HTML tags to angular-translate attributes, and creates translation table.


Languages

Language:JavaScript 100.0%