Localization and globalization file translate tool client side - javascript
Asked Answered
C

0

0

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.

Contemplative answered 20/12, 2018 at 7:37 Comment(4)
Do you want a tool that shows the english sentences to a persons and this person then can enter the translation for the given language or do you want a fully automated process to translate the sentences?Bricole
something like you have a file which have all English strings/objects, then that tool will automate the file and regenerate those strings to desired languageContemplative
While automatic translations became better in the last years (like deepl.com) they are still far away from being usable in an automated process. So you should either use a set of already existing translations, or let them translate by a person.Bricole
@Bricole do you know any API's to translate English string to some other language.Contemplative

© 2022 - 2024 — McMap. All rights reserved.