I am working on created a simple image bookmarking site with wordpress, currently it has a bookmarklet that allows user to collect images from other domains with one click.

This bookmarklet auto-fetches title from the source site and the problem with this process is that many other sites that user might collect images from, are gonna be non-english ones. so the bookmarklet will fetch that non english title and make a post with it.

Is there an easy solution to solve this? maybe by adding some function on function.php file that auto translates the non-english title to english by using google api maybe? If yes can you please give me the function code that can do this?

Thanks for Reading :) and sorry for the Bad english :P I would really appreciate any help.

2 Answers 2


If you want to make any text to be translated you have to use a plugin and mark the text as translatable. To do so you have to use __() or _e() instead of echo. The difference beetwen __() and _e() is that first one doesn't echo the text while second one does. So if you do something like this: __("Some text", "text domain") it will be marked as translatable text but it won't be displayed but if you use _e("Some text","text domain") the text will be also displayed on screen. Now if anyone will install a plugin he will see translated text

  • I don't think he is searching something like this - he wants it to be AUTO translated with some kind of external Translator.
    – Haudegen
    Commented Oct 28, 2016 at 12:30

actually it's really easy - with Google Translator API

  1. Get an API Key from Google.
  2. Write yourself a function (to the functions.php) to translate text.
  3. Profit.

Here is how to start and where you get the API Key etc.: https://cloud.google.com/translate/v2/quickstart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.