Translate Wordpress Automatically from Multiple languages to English - wordpress

There are a lot of plugins to translate Wordpress from e.g. English into German/French/Spanish etc.
But i am looking to achieve the opposite, i want to gather some international content and translate it automatically to English. Content will be added through WP All Import or through other import.
I will have the "international language code" per content available, so i could indicate the source language of the content.
I have reached out to several WP translation plugin developers, but they told me the plugin only work from one language to multiple others and not the other way around.
What would be the best way to get my Multilanguage content to English? I was thinking following options:
Have a custom extension to WPAI developed that translates on import, but the downside is that it is slow with higher volumes.
Perhaps it would be possible to have the content translated to English (if not available) when the page actually loads, and store the result in a column for future usage.
I don't know if above would be even possible, perhaps someone has some pointers on where i can search to find a solution for my case.

Have you tried the Loco translate plugin ? I know this looks like to be the opposite of what you are trying to do but this extension lets you select what theme, plugin and even specific strings you want to automaticaly translate. You can also add configuration files to translate anything on your website as you want.

Let me see if I understand correctly. You will have content in languages X, Y, Z (post in X, another post in Y, another in Z) and you want to separately translate each to English (E) like this?
X -> E
Y -> E
Z -> E
Or are you looking to somehow merge all the source languages into one (X,Y,Z -> E)?
If option 2 I have no idea how this would be done.
If option 1 then IMHO it doesn't matter from what and to what you want to translate. The question you need to answer is:
Which plugin(s) is(are) capable of automatically translating from all your source languages into English? For example here's a list of supported languages for WPML: https://ate.wpml.org/mt_langs
Once you import all the content into WordPress with the correct language codes which the translation plugin can recognize (to correctly perform machine translation), you will be able to translate each post/page into English using that plugin.

Related

WordPress translation

Often we see code like this:
__( 'Daily Archives: %s', 'twentyeleven' ),
First argument is string to be translated, and the second is domain used.
What's the purpose of this? Why does it need to be translated? And what's the outcome of the translation?
This answer really should/could be a comment; all the information you need about WordPress Translations can be found in the codex, here.
What's the purpose of this?
Internationalization and localization are terms used to describe the effort to make WordPress available in languages other than English, for people from different locales, who use different dialects and local preferences.
Why it needs to be translated, and what is the outcome of the translation?
Reading the codex, and the above paragraph (from the codex), will answer this as well.
But there is no need to translate it, it just adds to the users benefit to have translation/localizations available because not everyone speaks the same language.
Many theme creators make it a standard practice to develop themes that are ready to be localized because it not only adds extra value to their theme, it is (relatively speaking) not that much extra work to do.
An added benefit is that you can easily change wording on your website without having to add or edit the code. Or you can easily do things like making your website in 'Pirate'-language on national pirate day. Or pull pranks on the 1st of April by removing all vowels or something like that. - All of which are just a 'creative' (not necessarily intended) uses of translations.

How to add a new language to Plone

We need a way to classify pages or files as being of a language not already known in the standard language list in Plone/Zope. We don't need any translation or other functionality, just a way classify items as these new languages.
What is the best practice way of handling this?
We are currently looking at using ATVocabularyManager to import a new list of languages and then creating a plugin that uses schemaextender to adjust the vocabulary used by the DC metadata language field on all Plone content. Is there a more out of the box way of doing this?
Some of the languages we want to add don't have standard language codes such as Koori, Assyrian, SoranĂ®, Tetum, Dari and Karen.
We also have a similar but related need to display Chinese Traditional and Chinese Simplified using these names, rather than as Chinese China and Chinese HongKong.
Similar to Add new language in Plone , the best way is to contact the i18n-team for adding a new language, even if you don't have translation-strings, yet. They can be contributed step-by-step and in case also be overwritten for individual purposes.

Drupal modify translation of error message

i have an English Drupal installation but the frontend needs to be dutch. Now i asked a few weeks ago if it's possible to install a different backend and frontend language but this seems to be difficult. Now i only have one small message that isn't translated yet in the frontend and this is the required field error message (... field is required). How can i edit this translations? The may be an easy not so clean solution.
If you want an english backend and Dutch frontend you should use admin language that should fix that problem for you. In regards to translating the field required, that should be simple enough. It use a placeholder, so you might need to look for something like
#field is required
Drupal use this system when it use the same string with a dynamic value so you only need to translate it once and not for every combo.
thanks, for the admin_language module, but i found how to do this simple translation. You can override the translations using 'String overrides' ins settings.php

Translating external api results in Drupal

We're building a multi-language Drupal stack and one of the concerns we have is that our payment processor is going to have to send back some information to us. We've been able to narrow this down so that the strings they're sending back look like
<country code>-<number of months>
so we can easily translate that into any number of languages, except English.
t('FR-12') is all well and good if we want to translate that into a french description, but because there's not an English language a similar string like t('EN-12') is not translatable.
Similarly for the generic string: #API_Connection_Error
This sort of generic string approach seemed really compelling to me at first but it seems to not work in Drupal. Do you have any suggestions about how to translate generic strings like this into both English and other languages?
Thank you, I've been looking through Google all morning.
I see two ways to achieve this at the moment:
You could just replace the default English language definition with a custom version. That way, you can 'translate' selected English strings just as with any other language. If you have configured locale module to fallback to the original string in case of absent translations, you can just add your special cases as translations to your custom English version, and everything else will use the original English version.
Take a look at the String Overrides module - it allows you to define custom overrides for any string that gets passed through t(), with separate overrides per language, including the original English.
I'd use the second option in your case, except if the number of 'external' strings is very high. See the first if clause of the t() function for the mechanism used for the overrides (lookup in language specific Drupal variable arrays).
Note that the String Overrides module just adds admin UI pages to configure those Drupal variables in the Backend - you could add/adjust them yourself as well (e.g. from a custom module).

Storing content in multiple languages? E.g. English, French, German

How should I store (and present) the text on a website intended for worldwide use, with several languages? The content is mostly in the form of 500+ word articles, although I will need to translate tiny snippets of text on each page too (such as "print this article" or "back to menu").
I know there are several CMS packages that handle multiple languages, but I have to integrate with our existing ASP systems too, so I am ignoring such solutions.
One concern I have is that Google should be able to find the pages, even for foreign users. I am less concerned about issues with processing dates and currencies.
I worry that, left to my own devices, I will invent a way of doing this which work, but eventually lead to disaster! I want to know what professional solutions you have actually used on real projects, not untried ideas! Thanks very much.
I looked at RESX files, but felt they were unsuitable for all but the most trivial translation solutions (I will elaborate if anyone wants to know).
Google will help me with translating the text, but not storing/presenting it.
Has anyone worked on a multi-language project that relied on their own code for presentation?
Any thoughts on serving up content in the following ways, and which is best?
http://www.website.com/text/view.asp?id=12345&lang=fr
http://www.website.com/text/12345/bonjour_mes_amis.htm
http://fr.website.com/text/12345
(these are not real URLs, i was just showing examples)
Firstly put all code for all languages under one domain - it will help your google-rank.
We have a fully multi-lingual system, with localisations stored in a database but cached with the web application.
Wherever we want a localisation to appear we use:
<%$ Resources: LanguageProvider, Path/To/Localisation %>
Then in our web.config:
<globalization resourceProviderFactoryType="FactoryClassName, AssemblyName"/>
FactoryClassName then implements ResourceProviderFactory to provide the actual dynamic functionality. Localisations are stored in the DB with a string key "Path/To/Localisation"
It is important to cache the localised values - you don't want to have lots of DB lookups on each page, and we cache thousands of localised strings with no performance issues.
Use the user's current browser localisation to choose what language to serve up.
You might want to check GNU Gettext project out - at least something to start with.
Edited to add info about projects:
I've worked on several multilingual projects using Gettext technology in different technologies, including C++/MFC and J2EE/JSP, and it worked all fine. However, you need to write/find your own code to display the localized data of course.
If you are using .Net, I would recommend going with one or more resource files (.resx). There is plenty of documentation on this on MSDN.
As with most general programming questions, it depends on your needs.
For static text, I would use RESX files. For me, as .Net programmer, they are easy to use and the .Net Framework has good support for them.
For any dynamic text, I tend to store such information in the database, especially if the site maintainer is going to be a non-developer. In the past I've used two approaches, adding a language column and creating different entries for the different languages or creating a separate table to store the language specific text.
The table for the first approach might look something like this:
Article Id | Language Id | Language Specific Article Text | Created By | Created Date
This works for situations where you can create different entries for a given article and you don't need to keep any data associated with these different entries in sync (such as an Updated timestamp).
The other approach is to have two separate tables, one for non-language specific text (id, created date, created user, updated date, etc) and another table containing the language specific text. So the tables might look something like this:
First Table: Article Id | Created By | Created Date | Updated By | Updated Date
Second Table: Article Id | Language Id | Language Specific Article Text
For me, the question comes down to updating the non-language dependent data. If you are updating that data then I would lean towards the second approach, otherwise I would go with the first approach as I view that as simpler (can't forget the KISS principle).
If you're just worried about the article content being translated, and do not need a fully integrated option, I have used google translation in the past and it works great on a smaller scale.
Wonderful question.
I solved this problem for the website I made (link in my profile) with a homemade Python 3 script that translates the general template on the fly and inserts a specific content page from a language requested (or guessed by Apache from Accept-Language).
It was fun since I got to learn Python and write my own mini-library for creating content pages. One downside was that our hosting didn't have Python 3, but I made my script generate static HTML (the original one was examining User-agent) and then upload it to server. That works so far and making a new language version of the site is now a breeze :)
The biggest downside of this method is that it is time-consuming to write things from scratch. So if you want, drop me line and I'll help you use my script :)
As for the URL format, I use site.com/content/example.fr since this allows Apache to perform language negotiation in case somebody asks for /content/example and has a browser tell that it likes French language. When you do this Apache also adds .html or whatever as a bonus.
So when a request is for example and I have files
example.fr
example.en
example.vi
Apache will automatically proceed with example.vi for a person with Vietnamese-configured browser or example.en for a person with German-configured browser. Pretty useful.

Resources