Google translate po file




















You could download a tool like poedit and slog through the translation, but I felt there has to be a way to populate the file with at least some of the required translation, saving some of the grunt work.

Fortunately Google delivers although oddly I did not find the link through my initial google search! Obviously you need a Google account. This tool gives you a simple side by side workflow where you can see the original and edit the translation, but more importantly: Google will make a best effort attempt to translate your file for you! Then you proceed to select the. The contents of the file can be stored in any variable. In our case, the name of the variable will be contents.

We will also print the contents variable to check whether or not Python is properly reading the text file:. Make sure you have the above content in your text file if you want to follow along with our example. We have ascertained that Python is accessing and reading the text file. Now, we will translate the result by importing the same old Translate class from before. The next step is to pass the contents variable containing the input text to the translate function. Finally, print the text attribute of the object returned by the translate method and you will get the translated string.

To write the translated text to the same file, or a different text file, you will simply open the file in the write mode "w". Next, you need to call the write method and pass it your translated text, as shown below:. In the above example, we have used the context manager with to automatically open and close the write stream.

Secondly, we have opened the file in the write mode. Lastly, we have used the write method to write the translated string to a new file. Google Translate is a tool with an API that helps you perform a lot of different translation-related functions.

We have only scratched the surface with the above examples. You can click on "No Thanks", mark the translated file as "Complete", then download the auto-translated text. After google was motivating all of us around the world to "suggest" and translate for them for free, Cool ha? Show 6 more comments. OzzyCzech OzzyCzech 8, 2 2 gold badges 43 43 silver badges 28 28 bronze badges.

That's magnificent! Thanks — JohnWolf. When I planned to write my own translator, I came presearch search engine, by the way here and tried this project. As of Input File: template. Add entry. Id, entry. SerializeObject this. StartsWith Constants. Substring Constants. Substring 1, entry. Get language, entry. Translate language, entry ; this. Comment; clone. Value; clone. PO and POT files are essentially the same. The difference is in the intended use. This is why the two files have different extensions.

The tool that scans your PHP source will produce a. This file includes only the original texts, which need translation. You send this file to your translators. It will mark new or modified texts as needing translation and will leave existing translation intact. The best known tool is a program called poedit. A parser will go through your file and extract the texts for translation.

It counts the words and calculates the cost for translation. Then, you can choose translators for your project and get started. When translation is complete, you will receive back the completed PO and MO files.



0コメント

  • 1000 / 1000