1.1.5 • Published 2 months ago

malta-translate v1.1.5

Weekly downloads
18
License
MIT
Repository
github
Last release
2 months ago

npm version npm downloads npm downloads


This plugin can be used on: all files

Options :
- input : default 'it' ... yes Italian! but You can specify any language supported by @vitalets/google-translate-api (here is the list) - output : default 'en' but You can specify any language supported by @vitalets/google-translate-api (here is the list)

Sample usage:

suppose the outfile contains a label that should be translated:

hello.js:

...
var hello = "hello world", 
    presentations = "myname is Federico";

this is a .js file but could be anything, now if we want to translate it in german for example, we rewrite it like:

var hello = "i18n[hello world]", 
    presentations = "i18n[my name is] Federico";

now we can run malta on it using the malta-translate:

malta app/hello.js public -plugins=malta-js-uglify...malta-translate[input:\"\'en\",output:\"de\"]

or in the .json file :

"app/hello.js" : "public -plugins=malta-js-uglify...malta-translate[input:\"\'en\",output:\"de\"]"

and get :

public/hello.js

var hello="Hallo Welt",presentations="Ich heisse Federico";

if

...within a file that must be translated for example from en to de one particular word has always to be translated to japanese, regardless the input & output given parameters then is enough to mark it as:

i18n[always japanese|ja] 

###Cache

in the example will be created a file in the forlder where malta is executed a file named .malta-translate-cache-en-de.json which contains the cached results to avoid unnecessary requests; the outmessage of the plugin will containsome stats about hit/missed elements. Malta will create/update those files but will never delete them; if needed You have to delete em.

Backward compatibility

Malta-translate versions < 1.1 need malta < 4.1

1.1.5

2 months ago

1.1.4

2 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago