How to install a new language package to Drupal 6?

I have installed Drupal 6.0 with the default English version. Now I need to add multi languages to Drupal. After extracted a Drupal 6 translation package, for example, Dutch translation, I see Drupal 6 translations are put into a different package structure from Drupal 5. For Drupal 6 there are so many separated .po files under the different directories and sub-directories.

I don't know how to import these .po file at once. Is there any document detailing how to add a new translation package into Drupal 6?

Comments

astra’s picture

To go to Administer->Site building-> Translate interface->Import, I can see the description below:

Since this page only allows the import of one .po file at a time, it may be simpler to download and extract a translation package into your Drupal installation directory and add the language (which automatically imports all .po files within the package).

This description is not so clear for me to understand. What I try just like this:
to extract the Dutch translation package into my Drupal system (drupal/profiles/translations/)
to go to Administer->Site configuration->Languages->Add language
to select language Dutch (Netherlands) and click "Add language" button

But I can't see anything imported into my Drupal system.

What is the correct operation to add a translation package, which can automatically imports All .po files within the package?

jorisx’s picture

I Just downloaded a translation and it's full of foders and .po files.
Do I need to upload them one for one ?
Or can I upload the whole package somewhere so it batches all the .po files in one go .. ?

subscribing

Http://www.reloadmedia.com

mgifford’s picture

I found this a bit confusing too, and found the description in the profile a bit vague.

1) Essentially what you want to do is grab the language that you want from here:
http://drupal.org/project/Translations

2) In the case of astra, you'd want to grab the Dutch file, ideally you'd be doing this from the command line and you'd ssh to your Drupal root directory (say /var/www/html) and pull down the latest version of the file like so:
wget http://ftp.drupal.org/files/projects/nl-6.x-1.0.tar.gz

3) You would then uncompress it to distribute the .po files via:
gunzip nl-6.x-1.0.tar.gz
tar -xvf nl-6.x-1.0.tar

4) Which would put up about 20-30 .po files in the appropriate location. If you're doing a fresh install one of the locations it will stick a .po file is in
/profiles/default/translations

5) If there are .po files you can select a non-English language to install right when you are setting up your site. This will go through right there and load the 20-30 .po files that you untarred above. And voila your interface strings are translated.

6) Now, if you've already done the install, but decide you want to add another language, if you can just go back to step 1, skip step 4 (cause it's already installed) and go to the following path:
admin/settings/language/add

Choose your newly downloaded language, and add it. Again yoru 20-30 .po files will be added when you add your new language.

I was stuck because I wanted to add a translation to a new profile I was setting up and the documentation wasn't clear what should go in the /profiles/custom directory. I just needed to copy the /profiles/default/translations directory to /profiles/custom/translations and it worked.

Mike
--
OpenConcept | SEO | Tech | Screencasts

astra’s picture

Thanks for your description!

But not yet clear about where these .po files uploading.

Firstly I download Dutch translation package (http://ftp.drupal.org/files/projects/nl-6.x-1.0.tar.gz) to my local computer.

Then I uncompress nl-6.x-1.0.tar.gz and got many .po files within some folders (modules, themes, profiles ...) on my local hard disk.

But now I don't know EXACTLY where these folders and .po files have to be uploaded. For testing I uploaded them (all of the folders and files) to my website public_html/drupal/profiles/translations/.

After that I go to dminister->configuration->languages->add language, select Dutch language and hit the “Add language” button.

But it doesn't work, nothing happened.

Really need to provide a little more detail document about adding other languages in Drupal 6 by importing a language package just one click.

mgifford’s picture

There's not much I can offer you for advice there.

It is likely going to be easier to add a new language (without ssh access) by using the installer at the beginning and selecting the right language from the start.

I take it you've looked at this page:
http://drupal.org/getting-started/6/install/run-script

There's nothing on i18n installs here but if you click on:
Learn how to install Drupal in other languages

And you get something like this:
With the addition of an appropriate translation package, this installer is capable of proceeding in another language of your choice. To install and use Drupal in a language other than English:
- Determine if a translation of this Drupal version is available in your language of choice. A translation is provided via a translation package; each translation package enables the display of a specific version of Drupal in a specific language. Not all languages are available for every version of Drupal. http://drupal.org/project/translations
- If an alternative translation package of your choice is available, download and extract its contents to your Drupal root directory.
- Return to choose language using the second link below and select your desired language from the displayed list. Reloading the page allows the list to automatically adjust to the presence of new translation packages.
- Alternatively, to install and use Drupal in English, or to defer the selection of an alternative language until after installation, select the first link below.

This is quite straight forward with ssh, not sure exactly how to do it with FTP though... Just uploading the downloaded files here though:
public_html/drupal/profiles/translations/

Isn't going to give you a one click option though.

Mike
--
OpenConcept | SEO | Tech | Screencasts

ronniead’s picture

I also have found this very confusing! The documnetation is very unclear in how to do this.

What about if I already added the language (French). And NOW I want to extract the .po files, will your method still work? I'm assuming it won't because it needs to install the .po files...

Or will I have to delete the language, and then go through your steps?

AND...if I do delete the language, will that delete any content I wrote in that language???

I really don't want to manually import these language files...

cheers,

Ronnie

waddles’s picture

The instructions all seem to describe how to prepare a new site with a translation, but in our case, we already have a running site. You can import a gettext .po file at admin/build/translate/import but it wasn't clear what the contents of that should be.

Here is how I did it (on my local computer):

  1. Download the language file from http://drupal.org/project/translations - Eg. http://ftp.drupal.org/files/projects/es-6.x-1.0.tar.gz
  2. Unpack the archive to stdout, directing output to a file.
    $ tar xvzOf ../download/es-6.x-1.0.tar.gz --wildcards modules/* profiles/* themes/* > es.po
    modules/system/translations/general.es.po
    modules/system/translations/includes.es.po
    profiles/default/translations/es.po
    modules/aggregator/translations/modules-aggregator.es.po
    modules/block/translations/modules-block.es.po
    modules/blog/translations/modules-blog.es.po
    modules/blogapi/translations/modules-blogapi.es.po
    modules/book/translations/modules-book.es.po
    modules/color/translations/modules-color.es.po
    modules/comment/translations/modules-comment.es.po
    modules/contact/translations/modules-contact.es.po
    modules/dblog/translations/modules-dblog.es.po
    modules/filter/translations/modules-filter.es.po
    modules/forum/translations/modules-forum.es.po
    modules/help/translations/modules-help.es.po
    modules/locale/translations/modules-locale.es.po
    modules/menu/translations/modules-menu.es.po
    modules/node/translations/modules-node.es.po
    modules/openid/translations/modules-openid.es.po
    modules/path/translations/modules-path.es.po
    modules/php/translations/modules-php.es.po
    modules/ping/translations/modules-ping.es.po
    modules/poll/translations/modules-poll.es.po
    modules/profile/translations/modules-profile.es.po
    modules/search/translations/modules-search.es.po
    modules/statistics/translations/modules-statistics.es.po
    modules/syslog/translations/modules-syslog.es.po
    modules/system/translations/modules-system.es.po
    modules/taxonomy/translations/modules-taxonomy.es.po
    modules/throttle/translations/modules-throttle.es.po
    modules/tracker/translations/modules-tracker.es.po
    modules/translation/translations/modules-translation.es.po
    modules/trigger/translations/modules-trigger.es.po
    modules/update/translations/modules-update.es.po
    modules/upload/translations/modules-upload.es.po
    modules/user/translations/modules-user.es.po
    profiles/default/translations/profiles-default.es.po
    modules/system/translations/root.es.po
    themes/chameleon/translations/themes-chameleon.es.po
    themes/garland/translations/themes-garland.es.po
    themes/pushbutton/translations/themes-pushbutton.es.po
    

    Or as a one-liner:

    $ curl -s http://ftp.drupal.org/files/projects/es-6.x-1.0.tar.gz | tar xzOf - --wildcards modules/* profiles/* themes/* > es.po
    
  3. Upload the new es.po file to my Drupal 6 site at admin/build/translate/import
toemaz’s picture

Worked perfect for me. Thanks!

clau_bolson’s picture

Thanks!

What I see is that much of the administration is not translated (using spanish translation). Do you see the same, or is it a problem in my installation (drupal 6.4) ?

If it is not, is there a guide on how to translate?

prabash’s picture

plz be good enough to inform me above .po files insert in to which directory..

toemaz’s picture

For Drupal 6: admin/build/translate/import

prabash’s picture

Thanks.yes.. in french language package there are 40 .op files.i have import those 40 .op files separetly..

is there any method import those 40 .op files at once.

I have developed a website using drupal.Then i add language translation module to the site. but i have 2 problems. you can clearly undestand my problems if you chek my site...http://www.inca.lk/friends

1.when i click the language link(french or german).it will translate only the interface... but i want to translate content of (home,about us) my pages.. How Can i do it.

2. As a example when i in the "home page", then i click on the language link.(french or german) it will translate the interface in to german or french.. But then i click on the "About us" page..it will open in the default language(English). So..page by page i have to click on the language link to translate my pages. how can i solove my problem.

Thanks

toemaz’s picture

Buy and read a Drupal book.

wheck’s picture

Maybe it's too late to answer but I just started to use drupal, so I never read any drupal forum before. In order to do what you want to do (that is, have all your contents translated and showed when changing language), you need internationalization.
Here's a great tutorial about that.

http://drupal.org/node/275705

Hope this helps someone still.

tmai’s picture

Hello,

I believe that your way to import the files *.po from Drupal language translations download will work,but I cannot figure out how I can Unpack the archive to stdout, directing output to a file in Window, anyone know how to do i? please help.

Thanks
Thuan

jwilson3’s picture

if your developing on windows, you should definitely install cygwin. then this snippet will work.

James Wilson
Elementalidad

jwilson3’s picture

While your technique and code snippet seems to be the Right Way to do this (thanks!) I'm reporting here that the actual import of the resulting es.po didnt work.

My story:
After having enabled the Locale module and adding the Spanish language, I saw a measly 30% of the interface was translated... i began looking for a solution to fix this which led me too this thread. I followed your instructions using rather version 1.2 now that its out http://ftp.drupal.org/files/projects/es-6.x-1.2.tar.gz

I created the es.po file following your untar snippet, then downloaded and installed POEdit for mac and saw that the result of this 1.2 version was about 87% complete. I tweaked it a little adding my own translations bringing it up to 90% complete. then tried the import. It simply didnt work. No error messages, nothing, the percentage stayed the same on the site (~30% translated).

What I had to end up doing was to upload the es-6.x-1.2.tar.gz to the server, unzip in drupal root, Delete spanish language, then add it again... at that point it went through processing of 24 po files... and viola. Translated interface... but lacking my additions :/

There's still some serious bugs going on here in the translation handling.

nemesis_cen’s picture

it worked just fine... muchas gracias (supongo por el paquete de traduccón)

MantasK’s picture

This doesn't work for me.
I've used:
find profiles/ -iname "*.po" -exec cat {} >> language.po \;
find modules/ -iname "*.po" -exec cat {} >> language.po \;

hauke’s picture

At step 3) the system might gunzip and untar automatically. But do not click on the tar-file for further unpacking. You really need to use the terminal-Program. There you need to go into the drupal-directory and to untar with the mentioned command
tar -xvf nl-6.x-1.0.tar

There seems to be a difference.

ronniead’s picture

oops...had to edit this out...see above

arnoldc’s picture

It is somewhat confusing how to add a language package to an existing Drupal site. After reading a few threads, I conclude as follow:

1. download language package (tar.gz file)
2. copy your downloaded tar file to the root directory of your Drupal site
3. use a shell to extract the file. Essentially, this will place the .po files to the respective folder under your current directory structure. For instance, if you go to modules/node, you should now see a new folder named 'translations' and under it, you will see the associated .po file(s).
3a. if you are using FTP, extract this file to a temp directory and then ftp the content of the temp directory to the root of your site. Again, it should simply retain your site directory and just add the 'translations' folders and po files respectively.
4. now in admin->configuration->languages, add the new language and the system should automatically import all associated .po files for you.

Hope this will help to clarify a bit.

simon147’s picture

Hi all,

I have to admit that it took me quite some time to find out how to add a new language. But here is what I did and it worked super easy:

1. Get the language files you want from http://drupal.org/project/translations

2. Upload the zip file to the root of your drupal site directory

3. Unzip it there (in my case, the webpage backend has a file manager that allows to unzip files, otherwise you certainly unzip it with your command line if you have)

4. Go to "modules" and enable the "Locale" module (that's in Home › Administer › Site building › Modules).

5. Now go to Home › Administer › Site building › Translate Interface (which only appears once the "Locale" module is enabled), then click on "Import".

6. If you have previously added the files as mentioned in steps 1 to 3, then you don't have to upload additional files, but simply click on the "language page" link and then "add language" and choose the language of which you have previously uploaded the files. Then, the rest happens automatically.

What is important is that you upload the files to the server (steps 1 to 3) BEFORE you activate it in Drupal (steps 4 to 6) otherwise it won't work.

Hope that helps.

Simon

(PS: maybe an explanation like this should be added to http://drupal.org/project/translations)

www.okko.org

hansfn’s picture

You should look at How to install a different language - part of the Locale module docs - and potentially improved that page.

I do strongly agree that http://drupal.org/project/translations should point to the language install instructions.

Hans

Happy Drupaling!

corbacho’s picture

Should be added.

ricardodpsx’s picture

If your site is already installed and also the language you can do this:

1) Unzip the language file in your drupal/path.
2) Execute the next php code:
include_once './includes/locale.inc';
if ($batch = locale_batch_by_language('es', '_locale_batch_language_finished')) {
batch_set($batch);
}
Note: change 'es' for the language you want to install.

How you can execute that code?
You can use the Execute PHP utility of DEVEL module
http://drupal.org/project/devel