I want to add multiple languages to my site.
I read somewhere that I can use translator(Google or babelfish) but I don't like this way.
Can anyone suggest me different ways?
You could learn the language and translate it yourself. Besides that you will need to use a translator.
You'll want to read up a bit on internationalization and localization (often referred to as i18n L10n). You'll need code to support serving your various translatinons, based on your users' preferences. You'll also want to give some thought to handling things like date and currency formats.
As far as PHP tools, you've got the gettext stuff, which can be compiled in to PHP. Gettext works, but was designed to handle translating interface text for locally-installed software -- it doesn't transition to web sites/apps terribly well.
There's also Zend_Translate, which is a pretty good library, and can easily be used without most of the rest of the Zend Framework. You might want to look at Zend_Locale and Zend_Date, as the three can play together nicely.
You could integrate a translation interface to your site and let the users of your site create their own translation. This way, you get the translation for free.
Or, as an alternative, you could open your website logic to a community (i.e. make it open source) and let it translate by them...
Another way would be to hire someone to translate it into their language :)
if you have members in your site, do what FB is doing ..
they ask the members to help translating to their language, they put the phrases for them, and collect the translations + votes (whether the translation is good or there's better translation).
Related
I am the project manager on a website that needs to be converted into multiple languages. I am trying to figure out what the best option to go with is. I don't have a problem paying for something, but I just want to make sure it will work properly.
The options that I have thought of was to either (somehow) integrate google translate that when the user clicks on the language they want to read the page in, it updates the language for google to translate into. I did work with Google translate a little bit, but I found it to be little clumsy. Maybe I am not using it properly.
Another alternative I had, definitely not the best idea, but a backup if need be is to have the content put in a database and pulling the content dependent on the user's language. The only problem I have is that changing one word on the English version would have to change on every other language.
I am open to any other idea. I can clarify the project more, if need be.
As someone who speaks several languages, I can assure you that Google Translate often misses the mark. In many cases their translations are embarrassing, especially when you try to translate individual words or phrases without a sufficient context. Some language pairs are better than others, but overall this is not an option at this point.
Compiled languages have an advantage of static i18n, when a different version of a code is compiled for each UI language.
Database-driven dynamic i18n is a bad option, and almost all programming frameworks try to avoid it. I would recommend, therefore, that you look for an i18n solution that works with properties (text) files to lookup translated strings. In PHP this is gettext or intl.
Note also that i18n involves not only translation of text, but it also requires appropriate localization of dates, numbers, currencies, etc.
I don't have a problem paying for something, but I just want to make
sure it will work properly.
Based on that statement of yours I would like to suggest that hiring a firm that specializes in translation will be your best bet, then just put a multiple links that will lead to multiple languages of your website.
Problems that you might encounter:
Adjusting contents, some translations might be too short, some might be too long.
Using google translate can ruin your site, because sometimes it fails especially for some languages.
I'm in the process of creating a web app in PHP which will be available in many different languages (about 10 in total), and I'd like to know what you view as best practice for setting this up in more general terms.
My idea is to keep all languages under the same domain, with a suffix such as "http://myservice.com/de", where a script performs a location check upon site entering and redirects the user.
Editorial content will be shared between all languages as single posts in the database with a specific data column for each language.
Markup and scripts will all be documented in English, while pages and sections visible for the user will be translated into their respective language gathered from a common word library file.
A .htaccess file provides handling all rewrites for articles to display them in their appropriate language, i.e. "http://myservice.com/de/artikel/12345/" to "http://myservice.com/article?id=12345&lang=de".
What do you consider to be a clean and efficient multi-lingual setup?
Everybody has different opinions about how best to go about setting up an internationally-friendly website. However, I try not to reinvent the wheel by making my own system. Rather, I use the built in internationalisation and localisation tools in frameworks such as CakePHP.
From the CakePHP book;
One of the best ways for your applications to reach a larger audience is to cater for multiple languages. This can often prove to be a daunting task, but the internationalization and localization features in CakePHP make it much easier.
First, it’s important to understand some terminology. Internationalization refers to the ability of an application to be localized. The term localization refers to the adaptation of an application to meet specific language (or culture) requirements (i.e., a "locale"). Internationalization and localization are often abbreviated as i18n and l10n respectively; 18 and 10 are the number of characters between the first and last character.
http://book.cakephp.org/1.3/view/1228/Internationalization-Localization
Using the built-in tools, for me, offers an efficient way to translate applications without URL rewrites. It also means that a user can configure their localisation preferences and have them automatically applied every time they log in.
Such a method will also be considered more search-engine friendly because you won't get multilingual duplicates of the same content.
Hope this helps out.
The best advice i can think of is dont do this yourself
An existing open source CMS (Content Management System) might be a good solution, rather than building one yourself. Naming two leading CMS systems: Drupal, Joomla. (there any MANY more options)
These systems offer many features that work either out of the box with some configuration, of by an extension plugin (thousands of plugins).
Internationalization is just one of them. probably with a richer and more robust feature set than you can do yourself.
also, these systems offer a extensive API for extending them with your own business logic.
If you use ASP.NET (MVC 2 or 3) I suggest to read this article. I think it is one of the best practices in .NET
Does somebody knows a simple php language switcher. I'm not really a PHP savvy and I would like your help.
Thanks in advance.
The answer has already been posted, but let me give a brief explanation here.
Computers aren't smart. They don't understand higher level concepts like language. The fact is: computers can't look at a sentence and know what it means. Using advanced math and algorithms we can dissect the sentence and try to recognize key words, but something as simple as a misspelling could throw the whole algorithm for a loop.
Web services which perform automatic translation are not only buggy, but also tend to require LOTS of power and resources. That's why they're often only owned and operated by companies like Yahoo! (Babelfish) or Google (Google Translate).
Whenever a website has a simple feature for changing language (phpBB has a feature like this built in) the simple fact is that they typed everything several times. Once in English, one in Spanish, once in German... Then by clicking a button it determines whether to send you the English text, Spanish text, or German text. The same is true of wikipedia. When you view an article in two different languages they are not by ANY means the same article. Many times I'll read the Spanish wiki and the information will differ drastically. Two different people wrote two different articles, and by selecting a language you're just telling wikipedia which article to send you.
Your best bet if you really need your website translated at the click of a button is to add Google's Translate Tools. http://translate.google.com/translate_tools
There's no free ride here. You'll have to provide translated strings for every message displayed by your program. This article will get you started: Internationalization in PHP 5.3
yeah it requires some modifications
1. seperate your business logic from presentation layer via templating
2. in your presentation layer remove hard-coded text and replace it with php-variables
3. create your language files
4. depending on how you solved the case, puzzle your app together(hand over the data from the language files in the presentation layer)
I've been surprised by how little I've found on externalizing strings in PHP. Does everyone use gettext, or is there some other framework or tool that I'm not aware of?
Zend_Translate / Zend_Locale are nice and very flexible. They do not need the whole Zend Framework to be present. They support gettext moo/.po files but also CSV and other formats.
Hope this library helps you:
The i18n package is a punch of
classes for internationalization. It
gives you the possibility to maintain
multilanguage webpages more easily.
The translation strings are stored in
flat text files, special Gettext files
which are basically precompiled
translation files or in a MySQL
database. And it works independently
from PHP’s setlocale function.
I would say that you should use gettext because it is mature and easy to setup. Also BU using gettext you will be able to extend its useage for other type of sources than php. Consider the PO file format the standard for this.
Im working in i18n area for many years and I can tell you that gettext will provide you best results with minimal efforts if you have more than 50-100 strings in your project.
Once you've set the foundation for localizing your application, if you find yourself needing to manage and / or just get the actual translation done we have (what I like to think, obviously :) a pretty cool tool called String - http://mygengo.com/string
String is great for not just managing translations, where you can invite others to projects to help with translation, but you can order translations right in the service too. We've integrated our API into String to showcase our API and the ability to see status updates for numerous (100s...1000s) of jobs, translated by real people!
If you're interested in the API itself, we held a bounty contest not long ago with some fun winners for a number of platforms (Wordpress, Django, etc.): http://mygengo.com/services/api/lab/winners/
Just thought I'd share.
I have been looking at a few options for enabling localization and internationalization of a dynamic php application. There appears to be a variety of tools available such as gettext and Yahoo's R3 and I am interested in hearing from both developers and translators about which tools are good to use and what functionality is important in easing the task of implementation and translation.
PHP gettext implementation works very smoothly. And po files with po edit and gettext are about as good a way as you can get to deal with localization bearing in mind that no solution of this kind can completely handle the complexities of the various languages. For example, the gettext method is very good on plural forms, but nothing I've seen can handle things like conjugation.
For more info see my post here: How do you build a multi-language web site?
We've been tinkering withZend_Translate, since we use the Zend Framework anyway. It's very well documented and so far extremly solid.
In the past, I've pretty much used my own home-grown solution mostly. Which involves language files with constants or variables which hold all text parts and are just echo'ed in the view/template later on.
As for gettext, in the past I've heard references about PHP's gettext implementation being faulty, but I can't really back that up nor do I have any references right now.
There are a number of useful extensions in pecl:
http://pecl.php.net/packages.php?catpid=28&catname=Internationalization
In particular, you may want to check out php-intl, which provides most of the key i18n functions from International Components for Unicode (ICU)
the database driven solution to show the messages is not always the good one, I worked in a site with more than 15 languages and translations were an issue.
so our design was:
translation app in php-mysql (translation access, etc.)
then translations are written in php arrrays
these arrays are also cached in APC to speed up the site.
so to localize different languages you only need do an include
like
<?php
include('lang/en.php');
include('lang/en_us.php'); // this file overrides few keys from the last one.
?>
Xataface can be used to quite easily internationalize an arbitrary PHP/MySQL application. It support translation of both your static text, and your database data. All you have to do is add a line or 2 of code to a couple of places in your application and it's good to go.
http://xataface.com/documentation/tutorial/internationalization-with-dataface-0.6