ra-na / gtranslate-strings-xml Goto Github PK
View Code? Open in Web Editor NEWCreats a strings.xml file by Google auto-translating an input strings.xml file
License: GNU General Public License v3.0
Creats a strings.xml file by Google auto-translating an input strings.xml file
License: GNU General Public License v3.0
Error in downloading translated strings file from [https://asrt.gluege.boerde.de/]
I used your python scrips for translation , but they don't work anymore. I tried on Wednesday and then got a correct translation. Something happened on Thursday, which made your scrips no longer working. They can not translate anymore, they but lots of trash HTML code in the translated files. I attach the translated file and as you can see, it is full with trash HTML. Here is the URL to this file:
http://mobile-visuals.com/1590237496_de.xml
I will donate some $ to your project if you fix this issue!
Hi,
When trying to call he google script it gives the null NoneType error.
Traceback (most recent call last):
File "C:\Users\git\GTranslate-strings-xml\GoogleTranslate\gtranslate.py", line 280, in
INPUTLANGUAGE).replace('\ ', '\').replace('\ n ',
File "C:\Users\git\GTranslate-strings-xml\GoogleTranslate\gtranslate.py", line 178, in translate
if to_translate.replace(" ", "+"):
AttributeError: 'NoneType' object has no attribute 'replace'
the problem i here 👍
to_translate.replace(" ", "+")
I've tried to change this part of code :
if to_translate.replace(" ", "+") is Null:
print("this is null")
else:
r = requests.get(
"https://translate.google.com/m?hl=%s&sl=%s&q=%s" % (to_language, language, to_translate.replace(" ", "+")))
but i dont know what to do if it is null
Sometimes we need to use if we want to use html text that comes from strings.xml like for example the below text that now is not properly translated
<string name="EmailExportSettings_AuthenticationIssuesText">
<![CDATA[
<b>Connectivity with Gmail / Yahoo etc.</b>
<br/><br/>Public email clients have extra security options like 2 factor authentication that are not supported in applications like this one where emails are being sent automatically on background. If you want to send email using a public email client check their settings for an option to allow mobile applications to connect in the background. The recommended way to send emails is through personal email clients like the ones provided from personal / company domain name.<br/>
<br/><b>I didn\'t recieve any emails.</b>
<br/><br/>After setting your settings try to send an email by clicking the button send email now, if you get a message that says the email has been sent successfully this means that connection with your email has been established and the email has been sent. Check your spam folder or contact your internet provider and check if some of your incoming emails are being blocked.<br/>]]> </string>
https://asrt.gluege.boerde.de/
I am trying to translate my strings.xml file to an output file but it is throwing errors.
Upload successful, processing ...
Download link appears at the bottom after finishing.
Translation script output:
Traceback (most recent call last):
File "/var/www/html/maps/gtranslate.py", line 282, in <module>
tree = ET.parse(INFILE)
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 1229, in parse
tree.parse(source, parser)
File "/usr/lib/python3.9/xml/etree/ElementTree.py", line 580, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 205, column 51
Exit status : 1
[Translation download as XML](https://asrt.gluege.boerde.de/uploads/1679396880_kn.xml)
Traceback (most recent call last):
File "gtranslate.py", line 263, in
root[i][element].tail = " " + translate(root[i][element].tail, OUTPUTLANGUAGE, INPUTLANGUAGE).replace('\ ', '\').replace('\ n ', '\n').replace('\n ', '\n').replace('/ ', '/')
File "gtranslate.py", line 177, in translate
r = requests.get("https://translate.google.com/m?hl=%s&sl=%s&q=%s"% (to_language, language, to_translate.replace(" ", "+")))
AttributeError: 'NoneType' object has no attribute 'replace'
This script is working fine for language "ja" . But for languages like "kn" , "hi" it's generating random numbers. please help.
Thanks in adv.
I really like this tool. It saves me a lot of time. But most of time I need to translate many lanuagues. So can I do this at the same time?
I'm now using the translate and copy paste method. So the issue is when I copy my translation back to the textfield and press submit.
The xml file that I download has line numbers before the tags.
example below
` "<string name=""important">Attenzione!
4 "</string>"`
Hello
Input:
<resources>
...
<string name="translator_website">https://imknown.net</string>
<string name="translator_more_info">https://github.com/imknown</string>
...
</resources>
Output:
https://imknown.net-->�[1;31;40mWarning: Potential Charset conflict
Encoding as extracted by SELF : Shift_JIS"><meta name="google" content="notranslate"><title>Google 翻訳</title><style>#gbar,#guser{font-size:13px;padding-right:1px;padding-top:1px !important;}#gbar{padding-left:1px;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
</style><link rel=stylesheet href="/translate/releases/twsfe_w_20191118_RC00/r/css/desktop_ltr.css"><script></script><script>MSG_GOOGLE_TRANSLATE='Google 翻訳';MSG_SHARING_WEB_TEMPLATE='Google 翻訳で%1$sから%2$sに翻訳されました。';MSG_DISMISS='';MSG_BUTTER_BAR_BUTTON = '';MSG_BUTTER_BAR_DESC = '';BUTTER_BAR_URL = '';BUTTER_BAR_LOGTYPE = '';tld='.com';</script><script>var tn_,tn_aa="function"==typeof ...
The following file produces a lot of junk.
<resources>
<string-array name="pref_cond_weight_list_user" translatable="false">
<item>@string/pref_cond_off</item>
<item>1</item>
<item>3</item>
<item>5</item>
<item>10</item>
<item>15</item>
<item>20</item>
<item>30</item>
<item>50</item>
</string-array>
<string-array name="pref_cond_weight_list_values" translatable="false">
<item>0</item>
<item>1</item>
<item>3</item>
<item>5</item>
<item>10</item>
<item>15</item>
<item>20</item>
<item>30</item>
<item>50</item>
</string-array>
<string-array name="pref_location_setting_list" translatable="true">
<item>OFF</item>
<item>Network</item>
<item>GPS (and network)</item>
</string-array>
<string-array name="pref_location_setting_list_values" translatable="false">
<item>off</item>
<item>network</item>
<item>gps</item>
</string-array>
<string-array name="pref_duration_format_setting_list" translatable="true">
<item>Dynamic</item>
<item>Precise</item>
<item>No days</item>
<item>Hours + min</item>
</string-array>
<string-array name="pref_duration_format_setting_list_values" translatable="false">
<item>dynamic</item>
<item>precise</item>
<item>nodays</item>
<item>hour_min</item>
</string-array>
<string-array name="statistic_dropdown" translatable="true">
<item>All</item>
<item>Last 7 Days</item>
<item>Last 30 Days</item>
<item>Day</item>
<item>Week</item>
<item>Month</item>
<item>Year</item>
</string-array>
</resources>
The website display the same output as the input strings provided
Traceback (most recent call last):
File "D:\Downloads\Automatic String Resource Translation\GTranslate-strings-xml-master\GoogleTranslate\gtranslate.py", line 265, in <module>
root[i][element].tail = " " + translate(root[i][element].tail, OUTPUTLANGUAGE, INPUTLANGUAGE).replace('\\ ', '\\').replace('\\ n ', '\\n').replace('\\n ', '\\n').replace('/ ', '/')
File "D:\Downloads\Automatic String Resource Translation\GTranslate-strings-xml-master\GoogleTranslate\gtranslate.py", line 177, in translate
r = requests.get("https://translate.google.com/m?hl=%s&sl=%s&q=%s"% (to_language, language, to_translate.replace(" ", "+")))
AttributeError: 'NoneType' object has no attribute 'replace'
Hi, thanks for the tool seems great. One problem however - I'm using the python script in windows 10, it asks for all the things but then it works thru all languages and outputs the original file without translating.
Basically strings_es.xml , strings_de.xml etc are all the same as input string.xml file.
12 =========================
Send
Traceback (most recent call last):
File "gtranslate.py", line 280, in
root[i][element].tail = " " + translate(root[i][element].tail, OUTPUTLANGUAGE, INPUTLANGUAGE).replace('\ ', '\').replace('\ n ', '\n').replace('\n ', '\n').replace('/ ', '/')
File "gtranslate.py", line 210, in translate
r = requests.get("https://translate.google.com/m?hl=%s&sl=%s&q=%s"% (to_language, language, to_translate.replace(" ", "+")))
AttributeError: 'NoneType' object has no attribute 'replace'
Exit status : 1
The tool stopped working, always says Something went wrong
when i run like
py gtranslate.py
SyntaxError: invalid syntax
>>> py gtranslate.py
File "<stdin>", line 1
py gtranslate.py
^
SyntaxError: invalid syntax
>>>
<string name="audit">Audits</string>
[1;31;40mWarning: Potential Charset conflict
Encoding as extracted by SELF : utf-8"><title>https://translate.google.com/m?hl=es&sl=en&q=Audits</title>
I try to run: python gtranslate.py
And it's not working :(
Could you please help me?
`D:\Projects\Android\GTranslate-strings-xml-master\GoogleTranslate>python gtranslate.py Enter input filename: [default: strings.xml]
Enter source language: [default: en]
Enter output language(s): (space separated)
Traceback (most recent call last):
File "gtranslate.py", line 240, in
tree = ET.parse(INFILE)
File "C:\Users\Vitaly\AppData\Local\Programs\Python\Python38\lib\xml\etree\ElementTree.py", line 1202, in parse
tree.parse(source, parser)
File "C:\Users\Vitaly\AppData\Local\Programs\Python\Python38\lib\xml\etree\ElementTree.py", line 595, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: undefined entity: line 3, column 174`
Submit button disabled after choosing strings.xml.
Service has stopped operating, it outputs a corrupted file.
Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate, and Apertium. It gives you easy access to one of these translation engines in your terminal
https://github.com/soimort/translate-shell
Brilliant code, but please add descriptive comments if possible.
https://asrt.gluege.boerde.de/ This URL is not working. Kindly fix this issue.
It could be great if we could translate to many languages with one click, and to also save those translated files with the correct structure (values-language/strings.xml)
Also it would be REALLY nice if we have an option to not download them but to copy/ paste the result, this would be really helpful when you already have some translations and you want to add some new strings to them and you don't want to translate and download the whole files again.
Hi R-Na, this py script is very helpful. Though it has only one drawback, it cannot translate inside the . I'm not familiar with python. So could you please add this functionality to the project.
Thanks in adv.
Example:
What can I look for in the Blog section?
Do I need to be signed in to view blogs?
Who contributes to Blogs?
Can I contribute to by writing articles?
Can I reach out to the article contributors directly?
How does an article or blog become a featured article?
Hello ! Thanks for your tool, it is very useful. However, today I realized that it does not work from English to Danish/Dutch
Hi, first of all I love this tool, not sure what I would have done without it. Also donated without doubt.
I use the copy/paste method with the delimiters. I've gotten used to it, it's pretty quick.
Most of the translations that I do now are just adding new strings, not replacing the whole file.
It would be extremely useful if the webpage could show the ready < string / > tags instead of e.g.
2::Utility
-->Utilidad
This way I could just copy the < string / > tags directly from the page. Otherwise I have to open the file, highlight the tags (without < / resources > which takes time)
Is this at all possible?
If not then not problemo! :)
Thanks
Regards
Input:
<resources>
<string name="how_does_it_work_slide_description">First, enable the assistant with the play button then start playing the trivia app.</string>
</resources>
Output:
<string name="how_does_it_work_slide_description">Tout d'abord, activez l'assistant avec le bouton de lecture, puis lancez la lecture de l'application.</string>
The apostrophes need to be escaped to be valid according to Android Studio.
<string name="about_text_version">version <b>%1$s</b></string>
The above line in my file caused the following errors:
Traceback (most recent call last):
File "translate.py", line 262, in
root[i][element].tail = " " + translate(root[i][element].tail, OUTPUTLANGUAGE, INPUTLANGUAGE).replace('\ ', '\').replace('\ n ', '\n').replace('\n ', '\n').replace('/ ', '/')
File "translate.py", line 177, in translate
r = requests.get("https://translate.google.com/m?hl=%s&sl=%s&q=%s"% (to_language, language, to_translate.replace(" ", "+")))
AttributeError: 'NoneType' object has no attribute 'replace'
It works after I removed "%1$s" from the line.
Hello sir,
In the process of running the gtranslate program, the following error is output and the program does not run.
Any help on how to do this would be much appreciated.
Encoding as detected by REQUESTS : utf-8 [0m
[1;31;40mWarning: Potential Charset conflict
TH letters are broken comes like ??????? ?? ? ? ????
Hello,
Every time i try to translate the a string file i got this error
could you fix it please
[Upload successful, processing ...
Download link appears at the bottom after finishing.
Translation script output:
Traceback (most recent call last):
File "gtranslate.py", line 274, in <module>
tree = ET.parse(INFILE)
File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 1197, in parse
tree.parse(source, parser)
File "/usr/lib/python3.7/xml/etree/ElementTree.py", line 598, in parse
self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 176, column 85
Exit status : 1
Translation download as XML](url)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.