Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Localize Your Web Application for Any Country With the Google Translate API
May 04, 2015 @ 10:56:34

In this new tutorial to the NetTuts.com site author Jeff Reifman shows you how to use the Google Translate API to translate the content in your application/website to the language of your choosing. In his examples, he shows how to integrate it with a Yii framework application.

In this tutorial, I'll walk you through my extensions to the Yii I18n extract script which do exactly this. And I'll demonstrate translating my startup application, Meeting Planner, into a handful of languages. Keep in mind, Google Translate isn't perfect and it doesn't address issues related to time and date formats and currencies. But for a quick and affordable (free) way to build default translations for your web application into 50+ languages, this is an ideal solution.

He starts with a brief introduction to the Google Translate API, the languages it supports and how to install the library he's chosen to make the connection. He then gets into the internationalization (i18n) functionality that Yii has (an introduction to that is here) and how to define the "messages" files with the different content strings. These files are defined to there's no need to call out to the API for every piece of content that loads. He shows how to extend the message extraction handling to add in the API request and parsing the result. This information is then added to the current message information files, making it simpler to add in new strings. He then integrates this into the Meeting Planner application and shows how to run the script to call the Google API and switch the language with image results in several different languages of the finished output.

tagged: tutorial internationalization i18n googletranslate api yii framework messages

Link: http://code.tutsplus.com/tutorials/localize-your-web-application-for-any-country-with-the-google-translate-api--cms-23126

Building Your Startup With PHP: Localization With I18n
Mar 09, 2015 @ 10:43:08

In the latest part of their series of "building a startup" application in PHP, NetTuts.com looks at supporting internationalization with the functionality of the Yii framework.

This is part four of the Building Your Startup With PHP series on Tuts+. In this series, I'm guiding you through launching a startup from concept to reality using my Meeting Planner app as a real life example. Every step along the way, we'll release the Meeting Planner code as open source examples you can learn from. We'll also address startup-related business issues as they arise. In this tutorial, I wanted to step back and add I18n internationalization support to our application before we build more and more code.

They start off with a look at some of the overall goals of internationalization (i18n) and about how it works in the Yii system. It uses placeholders with a key/value system to replace the data based on which language is selected. They show you how to configure Yii's support including default language, sorting of the data and files to exclude when looking for i18n configurations. With this configuration in place they show how to use the command line tool to extract these messages out into separate folders for easier management and faster reference. Finally they show how to select a language and use the Yii code generator together with the translations to create models and forms.

tagged: build startup series part4 internationalization i18n localization language yii framework

Link: http://code.tutsplus.com/tutorials/building-your-startup-with-php-localization-with-i18n--cms-23102

SitePoint PHP Blog:
Building an Internationalized Blog with FigDice
Nov 26, 2014 @ 09:55:44

On the SitePoint PHP blog they've posted the second part of the series looking at using the FigDice for the templates in your application. In this new post they expand on the basics presented in part one and look at internationalization.

In part one of this two-part series I started looking at FigDice, a PHP templating system that takes a slightly different approach to most. [...] In this second and final part we're going to add a simple blog to our example site, which allows us to look in more detail at Figdice's concept of data feeds. We'll also look at internationalization, translating some of the site's content into a couple of additional languages.

In this part of the series (part two of two) they create a simple blog application based on their "Feed" class from before, faking some basic content. He then creates the factory class the FigDice templating will fetch the data from and makes a view to use it. He also talks about the optional functionality to add additional data to the feed output as attributes on the element. Finally he shows how to work all of this back into the HTTP framework under a "blog/post" URL.

tagged: internationalization figdice template library tutorial series part2

Link: http://www.sitepoint.com/building-internationalized-blog-figdice/

Internationalization How To for the 5 most popular PHP frameworks
Jul 24, 2013 @ 10:15:31

On the Lingohub site there's a new post showing how internationalization (i18n) is handled in 5 major PHP frameworks - CodeIgniter, CakePHP, Zend Framework Symfony and Yii.

As discussed in the previous articles on PHP internationalization, PHP provides native support for string translation using gettext and PHP arrays. These can be used in any PHP project. Additionally, some popular PHP frameworks offer their own way of string translation. In this article, I want to provide a brief summary of the internationalization process with five of the most popular PHP frameworks currently out there. In this How-To you will read about using CodeIgniter, CakePHP, Zend, Yii and Symphony.

There's only a bit of sample code here, so it's not a complete tutorial for all of them. Mostly its links to more information about how each framework does things - modules used, formats and configurations.

tagged: framework i18n internationalization howto codeigniter zendframework symfony cakephp

Link: http://blog.lingohub.com/2013/07/internationalization-how-to-5-most-popular-php-frameworks

Internationalization Made Easy
Nov 12, 2012 @ 13:15:58

In this new tutorial posted to PHPMaster.com, Hari K T takes a look at internationalization in a Symfony2-based application using its own translation component.

If you’ve ever worked to develop a site which needed to be available in multiple languages then you know how difficult it can be. With the help of Symfony2′s Translation component you can easily make internationalized sites. I’ll show you how with some sample code and some discussion on its API.

He includes a basic example of how the component works with the typical "hello world" translation from English to French. He mentions fallback locales, pluralization and the conversion between translation formats (like converting from a YAML file into a translation object).

tagged: internationalization symfony2 i18n framework component tutorial


Ibuildings techPortal:
DPC Radio: Let's take over the world with Zend Framework
Sep 21, 2011 @ 10:17:14

On the Ibuildings techPortal today they've posted the latest episode in their DPC Radio series as recorded at last year's Dutch PHP Conference. This episode is Martin de Keijzer's talk Let's take over the world with Zend Framework.

Many people use Zend Framework for it’s MVC implementation, but it has a lot of hidden gems. Internationalization (i18n) is one of them. We will look how you can create an application that will have the right languages, currencies, dates and times all based on the location of the visiting user. This session will take away a lot of headaches in international projects and will improve the quality in overall.

To listen you can either use the in-page player, download the mp3 or subscribe to their feed to get the latest. Martin's slides are also posted to Slideshare.

tagged: dpc10 dpcradio podcast zendframework internationalization


Anna Filina's Blog:
Doctrine Translation in leftJoin()
Apr 26, 2010 @ 11:39:33

In a recent post to his blog Anna Filina looks at internationalization in Doctrine and how Symfony auto-builds things to take care of it for you.

If you use Doctrine, then you probably know how lazy loading can hurt your performance. I carefully craft every query to everything that I need in one shot, but only what I need. One thing that evaded me at first was the i18n part. I am pleased with the way Doctrine + symfony magically creates all my models and database tables with i18n support.

She talks a bit about the internationalization (i18n) support is put into the schema.yml file and the bit of confusion she had over how to handle a left join using its structure. The key lies in the Translation relationships.

tagged: doctrine translation left join i18n internationalization


Zend Developer Zone:
Internationalization in PHP 5.3
Jul 06, 2009 @ 21:42:47

On the Zend Developer Zone Stas Malyshev has posted a new tutorial looking at the internationalization features that come bundled with PHP 5.3.

PHP 5.3 has been recently released and one of the new features in core is the internationalization extension. It allows you to support a multitude of languages and local formats much easier than before, without having to learn all the tiny the details of local formats and rules.

The internationalization extension makes it simpler to handle various language support in your application. Stas lists out some of the functionality included (including locale, number formatting and normalizing) and code samples to illustrate their use.

tagged: tutorial extension internationalization


Base Concepts of Internationalization in PHP
Aug 13, 2008 @ 09:37:12

The DevX website has recently posted this tutorial - a look at simple internationalization for your website.

If you develop Web applications that have an international target audience, then you have to take internationalization into account—a process that includes avoiding date/time or currency confusions and delivering all text pertinent to the user interface in the user's preferred language. Applications that can grow international traffic and improve revenue must respect their clients' needs.

They use the I18N PEAR package to handle most of the hard work and include the howto on grabbing the package, the structure and how to use it to get a country name from a code, work with the translation of numbers, currency and changing up date/time strings.

tagged: i18n internationalization tutorial concept currency datetime countrycode


Wen Huang's Blog:
Looking ahead to PHP 5.3 and 6
Jul 15, 2008 @ 11:15:30

Wen Huang has made a quick post to his blog about some of the comments Andrei Zmievski about the future of PHP, specifically on internationalization and UTF-8's place in it.

I attended the SF PHP Meetup last night where Andrei Zmievski (PHP 6 release manager and PHP core team member) gave a talk on PHP 6 and internationalization (i18n). [...] It was evident that Andrei and team have given quite a bit of thought into what i18n means for the PHP world, and as a result, PHP developers everywhere will soon be enjoying a new set of tools to enable faster development of multi-lingual sites.

He also mentions the back-port that several of these features will get into the upcoming PHP 5.3 release (along with the much-hyped namespace support). You can check out Andrei's talk on his website.

tagged: php5 php6 internationalization unicode andreizmievski talk i18n