OneThird CMS

Lightweight CMS for Small website, Web application framework.

Download Document

japanese

Google Site Translation sample code

In OneThird CMS, and how to use the multi-language plug-ins, and recommends how two ways to impart the translation data to the metadata


Here, we will introduce a very convenient way to combine the Google translation function in addition to the translation method that uses a metadata

This method is a method that is adopted in this site

  1. For pages that the translation has not been done, we want to display the Google translation tool
  2. Google translation tool is not displayed for the translated page
  3. The translation, like the semi-automatic generation to use the Google translation tool
  4. Specifically, OK just to add files / 1 / plugin / php code of about 200 lines to plugin.php


How to install

To use this method, you need to acquire the pre-Google translation tool

https://translate.google.com/manager/website/

Access to, please get the snippet for embedding (the acquisition need a Google account)

With the following settings, you can get when you click on the button "Get the code"

Enter URL → own URL of the web site


Web site of the language → their own language (Japanese)

and translate language → the translation you want language (English)

Display mode → Inline, pull down only

Advanced → Check the "contains content in multiple languages ​​to the page"


        

Embed code that can be acquired in more than sample PHP code

Sample PHP code you can be downloaded as follows:

google_language.zip


Please write the alphabet of the language name on the second line

Please write the English name of the site in the 19th row

Please insert the code obtained in 128 line


Furthermore, you'll add the following code to the / files / 1 / plugin.php


if (check_rights('edit') || trim($params['url_prefix'],' /')) {

@include_once(dirname(__FILE__).'/google_language.php'); 

}


Setting is the end or more


How to use

It will describe the case of English page


When you open the following URL only the set appears Google translated page of English

Site URL / en / page number


Or, if you click the "create en" to be displayed on the block menu in the state that opened the corresponding page English page opens


If you want to set the details of the immobilized or translation Google Translate and then click the Edit button in a state that opened the English page

In this case, if the edit button does not appear well, please to once disable the translation from the toolbar of Google Translation


Since the editing screen is displayed in English, click the [Fetch] button

Fetch a result, Google English translation will be taken


After adjusts translation Please save translation at [Save] button


You can easily find simple sentences and works well and only after the [Fetch] [Save], but, $link tags and in the text, $if the pre tag such as you are using the tag, and go well would be translated to tag by Google Translation you might not

Some degree of shaping, but it will be converted automatically when [Fetch], if the error occurs, please modify as appropriate



Google Website Translator - Google Translate