Move utils functions in fastTranslate and translate to utils file
Refactor fastTranslate to detect large jsons and split it to chunks limited by char size of 2000 characters. (Using char size as limiter here but feel free to change. Need a better token estimation for non-english langauges that don't use spaces.)
Create couple utils function for parsing purposes.
Missing from the PR: applying this change to translate and exportLocalFiles
Tested with below json
{
"hello" : "Hello!",
"welcome": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! ",
"welcome2": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 2",
"welcome3": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 3",
"welcome4": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 4",
"welcome5": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 5",
"welcome6": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 6",
"welcome7": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 7",
"welcome8": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 8",
"welcome9": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 9",
"welcome10": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 10",
"welcome11": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 11",
"welcome12": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 12",
"welcome13": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 13",
"welcome14": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 14",
"welcome15": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 15",
"welcome16": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 16",
"welcome17": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 17",
"welcome18": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 18",
"welcome19": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 19",
"welcome20": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 20",
"welcome21": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 21",
"welcome22": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 22",
"welcome23": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 23",
"welcome24": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 24",
"welcome25": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 25",
"welcome26": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 26",
"welcome27": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 27",
"welcome28": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 28",
"welcome29": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 29",
"welcome30": "Welcome to my app! This is a test sentance to test the limits lets try to break chat gpt! 30"
}
pRetry
library for retrying before giving upfastTranslate
andtranslate
toutils
filefastTranslate
to detect large jsons and split it to chunks limited by char size of 2000 characters. (Using char size as limiter here but feel free to change. Need a better token estimation for non-english langauges that don't use spaces.)Missing from the PR: applying this change to
translate
andexportLocalFiles
Tested with below json
Takes 2 translates to complete