Brifing
Adding word exception is one of this repositories plans. To explain the method I will add some example. This object is source below,
{"target" : "source, exceptThis"}
and this would be an object as a result below without translating exceptThis,
{"target" : "translated source, exceptThis"}
The source is translated but exceptThis isn't. This is a rough idea. There would be may ways to add this method and one of ways would be decided by contributing.
How the object is translated
Before adding the method, a short brief of the repository. The values of objects are added up as a string and the string is translated by the module and then translated string is split up to replace the value of object.
The repository deep-copy a target json object by recursion to add up all values of the object in it. All added value will be one string and put into this node module. After the module translating the string by Google Translate API, the translated string is divided and each divided string will replace values of the object. I can not deny but saying the algorithm is complicated and crude. If someone tried to understand the whole code then I would excuse. The process should be refactored.
Why adding up and dividing values is chosen
Using the module with each value with many time like over 1000 makes an error. Added up string value has no error from the module.
Adding up and dividing strings is kind of bothersome process. But there is a reason to take this process. When putting each target value into the translate module, it perfectly works. But when putting bunch of values like over 1000, it occurs error. The reason is that when the module ask Goggle Translate API to translate one value, the API response with translated value. But when the requesting is many like over 1000, Google Translate API refusing the request. The error message was like request is too many. Since the repositories plan is translating with various languages, asking many request is unavoidable. And asking request with added up string(the size would be same but request time is less) has no error. That's why adding up, dividing values of object is chosen for the method.
Brifing
Adding word exception is one of this repositories plans. To explain the method I will add some example. This object is source below,
{"target" : "source, exceptThis"}and this would be an object as a result below without translating
exceptThis,{"target" : "translated source, exceptThis"}The
sourceis translated butexceptThisisn't. This is a rough idea. There would be may ways to add this method and one of ways would be decided by contributing.How the object is translated
Before adding the method, a short brief of the repository. The values of objects are added up as a string and the string is translated by the module and then translated string is split up to replace the value of object.
The repository deep-copy a target json object by recursion to add up all values of the object in it. All added value will be one string and put into
this node module. After the module translating the string by Google Translate API, the translated string is divided and each divided string will replace values of the object. I can not deny but saying the algorithm is complicated and crude. If someone tried to understand the whole code then I would excuse. The process should be refactored.Why adding up and dividing values is chosen
Using the module with each value with many time like over 1000 makes an error. Added up string value has no error from the module.
Adding up and dividing strings is kind of bothersome process. But there is a reason to take this process. When putting each target value into the translate module, it perfectly works. But when putting bunch of values like over 1000, it occurs error. The reason is that when the module ask Goggle Translate API to translate one value, the API response with translated value. But when the requesting is many like over 1000, Google Translate API refusing the request. The error message was like request is too many. Since the repositories plan is translating with various languages, asking many request is unavoidable. And asking request with added up string(the size would be same but request time is less) has no error. That's why adding up, dividing values of object is chosen for the method.