Topic: Using translate plugin to translate your Kete installation
Topic type:
How to setup, and use the translation and localization interface built into Kete.
In Kete 1.3, there is a translation interface which is accessible via a url (/translate) while in development mode. See the Installation Guide for details on how to set up your site in development mode.
Note: The "Save Translations" button only appears if you are using the translate feature without Javascript enabled. Otherwise, each time you finish changing a translation field, the translation is automatically saved.
The above image is a screenshot of that translation interface. From the top down:
- Show links allows you to filter what keys you are viewing. They're all pretty self explainatory.
- Sort by allows you to sort the strings by the key name, or by the actual text value.
- Translate from. The first select box is an already translated locale such as Englighs (en). The second select box is the language you want to translate to. You'll need to have setup a new translation file in config/locales before it'll show up in this dropdown. DETAILS TO BE ADDED
- Key/text fields allow for searching through the keys/text for a specific translation.
- The 'Save translations' button takes what you've edited and dumps it into the translation file. As mentioned above, in most cases this is done for you automatically now.
- Enter the new translation into the text field in each section
- 'Auto translate' sends the text to google for automatic translation. It won't be perfect, but it'll get you started.
- Key and File give context of where this text is used (you can't edit them though)
When you've finished a page (if it appears, click Save Translations button), go to the next page, and continue. Do this until everything is translated.
Your translations are automatically reloaded on each change to your translations. If you refresh the page your translation appears on, it should reflect your new translation.
If you are doing a new localization of Kete, please consider submitting it to the Kete team so that it can be made available to the community at large.
Discuss This Topic
There are 23 comments in this discussion.
Read and join this discussion
> i downloaded the new kete yesterday and it running well
>
> but
>
> the /translate URL not found
>
> how i can use the translation plugin , and add my own language
This must have slipped by in the past. The /translate interface only runs when the site is in "development mode". You'll need to refer to the Installation Guide for details, but one thing to look out for is that Passenger (a.k.a. mod_rails) runs a site in "production mode" by default (more info here, look for the RailsEnv parameter).
Tags: translate
Hi,
To use the /translate interface you must be running your site in development mode (i.e. not RAILS_ENV=production). The idea is that you do the localization before you set up your production site or you do it separately on a "staging" site and copy the localization file into place for production.
Could you confirm that your site is running in development mode please? You should be able to tell this by whether your log/development.log file adds a new line when you have a request hit the site.
Cheers,
Walter
Hello Walter,
We have installed a copy of Kete on Kete 1.3 at http://kete.maktabat-online.com/ to be worked on for the Arabic support. We are planning to solve the ICU issue with Zebra search. Ahmed is working on the issue.
We realized though that it is not quite ready for supporting the Arabic language at both UI and /translate support. Ahmed seems to think that the available 1.3 software we installed is not quite ready for multi-language support. Do we need to have additional pieces of the software for supporting Arabic UI and /translate yet to be included in the available beta 1.3 release ?
Please make sure to Include Arabic with the other four languages already included by default.
Thanks, Massoud AlShareef, KnowledgeWare
Tags: Arabic, translation, UI, Multilanguage
> We have installed a copy of Kete on Kete 1.3
> at http://kete.maktabat-online.com/ to be worked on for the Arabic
> support. We are planning to solve the ICU issue with Zebra search. Ahmed is
> working on the issue.
Great to hear. I'm looking forward to seeing it resolved.
>
> We realized though that it is not quite ready for supporting the Arabic language
> at both UI and /translate support. Ahmed seems to think that the available 1.3
> software we installed is not quite ready for multi-language support. Do we need
> to have additional pieces of the software for supporting Arabic UI and
> /translate yet to be included in the available beta 1.3 release ?
Until 1.3 is released, I would upgrade from the "master" branch of development pretty often. We haven't featured frozen 1.3 yet.
You should review the November 2009 Kete Community Meeting Minutes to see where things stand. Basically the community has talked about doing some organizing and fundraising necessary to support the 1.3 release management process. One advantage of this is that the community gains independence from any particular company, but it does slow things down a bit.
To get back to Ahmed's comments. With the localization of the interface, there is a gray area of things that aren't handled by the /translate mechanism. These are things like basket names (the About and Help areas are baskets, for example), extended fields labels and they are actually dynamic, meaning they are simply values in the database. To localize them involves a different process. We have a plan for how to implement the functionality and are seeking funding for the work. I'll let you know if this work proceeds.
Note that I'm talking about how to localize these dynamic elements of the interface (things entered by administrator, but appearing to be just another part of the site's interface to end users) for multiple language support. For Kete sites that only want to support one language and that language is different than English, you can change the values using the current tools. E.g. you want the topic type "Person" to be "شخص", go to the Administrator's Toolbox, click "topic types", hit "edit" next for the "person" topic type and replace the text in the name field as appropriate.
>
> Please make sure to Include Arabic with the other four languages already
> included by default.
Noted. Thanks.
>
> Thanks, Massoud AlShareef, KnowledgeWare
Good to hear from you Massoud and keep us posted about how things are progressing.
Cheers,
Walter
Tags: Arabic, translation, UI, Multilanguage
Ahmad Maher
said Save failed
hello ,
i set up the arabic language in the kete translate page
but it dosen't save any translation
this message appeare behind the the translate text bos " Save failed "
Can you confirm that you have a file found at your_app/config/locales/ar.yml, please?
Judging by your other recent comment, you haven't successfully created the ar locale file to actually save the translations to.
Cheers,
Walter
i created it by copying the english one ' en.yml'
with ar.yml name and changed the first line to ar:
Kieran P
said Re: Save failed
Hey Ahmad,
I just created a file using the same technique, and was able to translate a few base words in the translation without any problem.
Please make sure you have selected "from 'en' to 'ar'" in the form at the top of the page and clicked "Display". Also, when you click. Please also make sure that the ar.yml file is readable and writable by everyone (to eliminate permissions from the cause).
Regards
Kieran
yes i followed these steps but it is the same error
you can try it
http://kete.maktabat-online.com/translate
Kieran P
said Re: Save failed
Ok, I get the same error message from your installation. Can you run the following please from the Rails application root?
rm -rf config/locales/ar.yml
rake translate:create LOCALE_CODE=ar LOCALE_NAME=Arabic
echo "" > log/development.log
touch tmp/restart.txt
Then go to the translate interface again, and try it. If you get the same error, upload log/development.log to this Kete, as a related document of this topic. I'll take a look at the error and see if I can spot what is going on.
Regards
Kieran
hello ,
when i make the translation , the development log file dosen,t contain any new log data
it's empty .
Kieran P
said Re: Save failed
Hey,
Hmm. So did you try to save a translation after removing ar.yml and using the rake task to populate it?
On my local machine, the save still works and I get data in log/development.log about the request to save it.
Please make sure you are running the latest copy of Kete. Do a 'git pull' from the app folder.
Regards
Kieran
Kieran P
said Re: Save failed
Hmm. Looks like it is a permissions issue. When I try to save a translation, the following data comes back from the save request:
Permission denied - /root/apps/kete/config/locales/log
So it looks like the Apache process does not have access to write to where you are exectuing Kete from.
For now, you could get around it by doing this:
# mkdir /root/apps/kete/config/locales/log
# chmod 777 /root/apps/kete/config/locales/log
But there may be other issues such as uploads or caching failing because it can't write them.
Regards
Kieran
thank you Kieran ,
the problem solved
As we have added more features to Kete before the 1.3 release, there are more pieces of text that need translating. If you have already begun the translation process, you may need to update your localization (e.g. config/locales/ar.yml doesn't have all the text that needs translating that config/locales/en.yml does). Here's the process for grabbing the new text that needs translating:
First, you'll need a new version of I18n installed (0.3.3 or higher), then do:
$ rake translate:merge BASE=en OTHER=ar
After that you should have the new text that hasn't yet been translated from english and you can resume using the /translate functionality from the web interface.
Tags: translate, Translations, locale, localization
hello Walter ,
when i installed the i18n and try to run the command
it returns this error :
wrong number of arguments (4 for 3)
Tags: i18n
it work well ,
when use i18n version 0.3.3 not hiegher ,
but , still there are text not found for translation like "Previous , next" in browsing topics
Tags: i18n
The best advice I can offer is when you come across something that you can't find via translate, is to look at the corresponding template file (under app/views) and find the corresponding translation key. Once you have the key, you can search for it via the /translate interface.
So for your "next" and "previous" issue:
- I open the "app/views/layouts/application.rhtml" file in my text editor. It is the wrapper template for almost all pages (you may have to familiarize yourself with the Ruby on Rails templating system and learn about layouts vs partials vs normal templates and then familiarize yourself with Kete's templates).
- Find that the partial template "topics/slideshow_controls" is called. With partials, they have a naming convention that the filename in the filesystem starts with an underscore. The actual file for the template is app/views/topics/_slideshow_controls.html.erb.
- Open that file in a text editor and see that two "helper" methods (familiarize yourself Ruby on Rails helper methods) are called; link_to_previous_in_slideshow and link_to_next_in_slideshow.
- I find a corresponding app/helpers/slideshows_helper.rb file and open it in my text editor.
- I find the two method definitions and see code that looks like this for the next helper (basically the same for the previous helper):
... text = t('slideshows_helper.next') ...
- The "t" is shorthand for the "translate" method and takes a key name for a piece of text to look up the translation for. Thus I know that what I need to translate has the key "slideshows_helper.next" and "slideshows_helper.previous".
- I then go to the /translate interface and use the form there and set the fields to "key" and "contains" and then input "slideshows_helper" (figure just get all of them in one go) and get the results.
Now, there is a shortcut. If you know what the phrase is in English, you will usually find what you are after with a "key" and "contains" and then one of the main words as the text input. For example, if I search for "key" and "contains" and input "next", there are six results and the last one is the one you would be after.
Tags: i18n, translate, Translations
We updated the Arabic translation file using "rack... " command as suggested. We did not find any of the terms we searching for in English. All of them are already translated. This means that we have all instances of words we seeking to translate, like "next", "all", "Previous", "Random", "in", "of" have already been translated before the update but not necessary they appear in Arabic as they should be.
What does this mean? In our view, though these words are attached to synamic variables, sometimes programmers may over look to change the value of these variables at ceratin instance and thus they default value will always regardless of the language change. For instance, we found all six occurrances of "next" translated to Arabic but still appears in the browsing page when you list results of items under any content type. The same thing with Random, it still appears in English at the front page when it displays Random Images from the Archive.. See it here please: http://kete.maktabat-online.com/ar/%D8%A7%D9%84%D9%81%D9%86_%D8%A7%D9%84%D8%AC%D9%85%D9%8A%D9%84
Thanks, Massoud.
Tags: i18n, translate, Translations
I browsed through a set of results on your site in the ar locale and the "next" and "previous" links were translated. Here are the steps I followed:
- visited the http://kete.maktabat-online.com/ar/الفن_الجميل basket homepage (noticed "Random" in images slideshow is not translated)
- clicked the link for browse the basket's contents that led me to الفن الجميل
- clicked the fourth result that led me to ادباء السعودية يلتقون ليتواصلون
- التالي » and « السابق were both in the slideshow navigation
- also noticed that "of" is not translated in "عرض: 4 of 12"
- I found in the app/views/topics/_slideshow_controls.html.erb file that there is a key called topics.slideshow_controls.current that is translated
- I searched for that key in the /translate interface
- That particular piece of text is mostly filled with variables that are substituted in and translated accordingly without further work, but "of" is not.
You should be able to use /translate to take care of that stray "of" (you may want to adjust placement of words, too).
Could you confirm that "next" and "previous" are now translated for you and the remaining issue is "Random" and the "of 12", please?
I looked into the "Random" issue by following my previously posted procedure (going through the templates until I found where the word or phrase is used). The issue occurs because basket homepage's may have a "latest" or "random" slideshow depending on a setting that is stored in the database and it only reuses the setting's word. I'll make an adjustment that looks up the translation for that word and does the right thing. Expect an update later today. Thank you for pointing out the issue.
For future issues like these, if you can determine which file and which line the issue occurs on we can patch them faster.
Tags: i18n, translate, Translations
> I looked into the "Random" issue by following my previously posted procedure
> (going through the templates until I found where the word or phrase is used).
> The issue occurs because basket homepage's may have a "latest" or "random"
> slideshow depending on a setting that is stored in the database and it only
> reuses the setting's word. I'll make an adjustment that looks up the translation
> for that word and does the right thing. Expect an update later today. Thank you
> for pointing out the issue.
I've fixed the issue. It should be resolved if you update to latest Kete code.
Let me know if you find other issues like this. Thanks again.
Tags: i18n, translate, Translations
By the way, the site is looking really good! Nice work!
Tags: i18n, translate, Translations
Ahmad Maher
said /translate not found
hello ,
i downloaded the new kete yesterday and it running well
but
the /translate URL not found
how i can use the translation plugin , and add my own language
thanks
Tags: translate