Localization and globalization file translate tool

2019-08-27 17:55发布

问题:

I'm a member of a team with more than 20 developers. Each developer works on a separate module. In each module, We load data only for the desired language. For this purpose we save data to a separate files for each language.

Example Module 1:

locale (root folder)

    en
        en.js
    pt
        pt.js
    fr 
        fr.js

en.js is,

define(function() { 

    var label = {
        "name" : "Name",
        "age" : "Age",
        "location" : "Location"
    }

    var message = {
        "save": "data saved",
        "update": "data updated"
    }

   return {
        label: label,
        message: message
    };

});

I will use this obj in my module wherever applicable, like fileName.label.name that will print "Name" in desired place.

like that if a user change the language from english to french(fr) I will get the data from fr.js, which looks like something below:

var label = {
        "name" : "****",  [*** - something in french]
        "age" : "***",
        "location" : "***"
    }

so fileName.label.name will print the french text.

Here, I'm struck with converting/translating those en file to french and other languages.

I would like to know is there a tool which can translate files and generate desired language , and there will be N number of modules if there's a generalized way to translate would be grateful like give a path of locale files and the tool will give the dedsired op.