0

i want to build a multi-language site (Chinese and English). From the documentation, I know I should install the Internationalization module, so i installed it, but there are some parts on my site that are not translated.

  1. There are some parts as the following in every page (the Chinese version):

    <h1><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>">测试公司</a></h1>
    

How do I translate 测试公司 when English is the set language?

  1. On every page's top right part, there are some parts as the following:

    <div id="topnav"> 
      <a href="#" onclick="return setHomepage();">设为首页 |</a><a href="#" onclick="return addCookie();">&nbsp;添加收藏  |</a><a href="http://example.com/" class="zh">&nbsp;简体中文</a><a href="http://example.com/en" class="en">&nbsp;English</a>
    </div>
    

How do I translate 设为首页, 添加收藏 and 简体中文 to English, when the user access http://example.com/en?

I know I can put that content in a block, then translate it, but it's too weird.

Is there a simple way to get that?

ps: why this one that i can't translate(english-->chinese)? the code is used to alter the conntact form . $form['mail'] = array( '#title' => t('E-mail'), '#type' => 'textfield', . when i searched the E-mail in the translate interface, i can't find it,but when i changed E-mail to test. then i can search it. why? thank you.

0

You must use the t function on all text if you want translate it directly throw the admin panel.

  • how to use the t function .could you make me an example. thank you – runeveryday Aug 25 '11 at 1:29
  • You've many examples and better explanation in the link I give you for t function. (api.drupal.org/api/drupal/includes--common.inc/function/t/6) – yvan Aug 25 '11 at 5:15
  • 1
    Just a side note: t() is not used to translate from Chinese to English, but it is used to translate a string in English in the language set for the page, or for the user. If I pass a string in Chinese to t(), the function will return the exact same string it got as argument. – kiamlaluno Aug 25 '11 at 7:38
  • @kiamlaluno you can use the third parameter to tell that your string is Chinese and you can translate it in English as well. – yvan Aug 25 '11 at 8:34
  • No, you cannot. The source language is always English or, to be more precise, American English. The parameter you are referring to is described as (Drupal 6 documentation): "$langcode Optional language code to translate to a language other than what is used to display the page." It's the language to which the string is translated, not the language from which the string is translated. – kiamlaluno Aug 25 '11 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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