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

Toptal.com:
How to Build a Multilingual App: A Demo With PHP and Gettext
Jan 10, 2017 @ 19:51:13

The Toptal.com site has a tutorial posted from Igor Gomes dos Santos about building a multilingual site with a combination of gettext and PHP.

Whether you are building a website or a full-fledged web application, making it accessible to a wider audience often requires it to be available in different languages and locales.

Fundamental differences between most human languages make this anything but easy. The differences in grammar rules, language nuances, date formats, and more combine to make localization a unique and formidable challenge. [...] The way your code is organized, and how your components and interface are designed, plays an important role in determining how easily you can localize your application.

The tutorial starts off talking about some of the difficulties that come along with internationalization of an application and how localization comes into play. He then starts talking about gettext and links to several PHP libraries that can help you integrate support for it into a current (or new) application. He walks you through the setup of gettext, how the PO/MO files are structured and other things to like about like domain separation, locale codes and the directory structure of your PO/MO files. He then gets into a practical example, showing a sample PO file's contents, two schools of thought on the identifiers in the file and a simple template that uses the "gettext" to get a translation. He also includes code to set up the locale correctly and create the language files for it to use.

tagged: multilingual website gettext tutorial internationalization

Link: https://www.toptal.com/php/build-multilingual-app-with-gettext

Laravel News:
How To Add Multilingual Support to Eloquent
Sep 09, 2015 @ 14:36:52

The Laravel News site has a tutorial they've posted showing you how to help internationalize your application by adding multilingual support to Eloquent in your database schemas.

Did you know that several countries throughout the world have more than one official language? For example, my home country Belgium has three; French, Dutch, and German. Most Belgians also speak English. Laravel’s Eloquent ORM is a very powerful part of Laravel. Unfortunately, it doesn’t provide support for multilingual models out of the box. Adding that functionality yourself isn’t that difficult.

They start with a basic migration with no multilingual support included, a simple "articles" table. They show how support could be included by adding columns for languages but suggests that using a "translated" table for the other versions is a better option. With this schema in place, they then show how to use the laravel-translatable package and Translatable trait to handle the pull and push of the translated data from the database automatically. It can even be set up to pull which version it should display directly from the application's locale setting.

tagged: multilingual support eloquent translatable package locale tutorial

Link: https://laravel-news.com/2015/09/how-to-add-multilingual-support-to-eloquent/

PHPBuilder.com:
Building a Multilingual PHP Website
Sep 01, 2011 @ 14:02:21

On PHPBuilder.com today there's a new post from Vojislav Janjic with three methods (sans-framework) that you can use to create a multilingual website - some a bit easier to maintain than others.

Fast internet growth has brought many opportunities in the global market. Businesses can reach their customers across many countries, and information sharing is not limited to a local area or country anymore. This is why there is an increasing tendency for multilingual websites. By having a website in multiple languages, you can target local markets more easily. Also, it is more convenient to use a website in your native language.

His three methods are all relatively simple, but they all have their good and bad points - making separate HTML/views for each language, creating XML files with different versions of the content or storing the translations in a MySQL database. He gives quick code snippets showing how to implement each of them, some basing the language on a cookie value, others on a GET variable passed to the page.

tagged: multilingual website tutorial mysql xml html translate

Link:

PHP-GTK Community Site:
PHP-GTK.eu goes multilingual
Aug 18, 2008 @ 16:18:25

The PHP-GTK Community site has gone multilingual to help reach out to a broader audience:

A new block has appeared today on top right corner of the php-gtk.eu pages, with three little flags : they show you can now navigate the site in one of these languages and, more importantly, automatically find the translated versions of all articles when they exist ... or contribute one yourself if you are logged in to the site.

Right now they offer English, French and German and they're still working on translating some parts of the UI of the site, but the articles and content should be translated over just fine.

tagged: multilingual phpgtk website english french german

Link:

ThinkPHP Blog:
Multilingual Websites with PHP
Jul 15, 2008 @ 12:55:38

On the ThinkPHP blog, Florian Eibeck has posted an overview of some key things to consider when internationalizing your application/website.

The biggest problem is that most developers lack knowledge about Internationalisation, Localisation, Character encodings, Unicode and all those terms connected with multilingualism. The following article should give you a basic understanding and show you how to avoid those funny characters.

He defines a few terms - internationalization, ASCII, unicode and the UTF-8/ISO-8859 character sets. He mentions how to accept the utf-8 string into your application and how to use it in both PHP and store it in a MySQL database.

tagged: multilingual website internationalization i18n utf8 unicode

Link:

Developer.com:
Build Multi-lingual Websites With the Zend Framework
Jun 15, 2007 @ 18:29:54

Developer.com has a new tutorial posted today dealing with a specific use of one of the more popular PHP frameworks currently, the Zend Framework, and using it to create multi-lingual websites from Jason Gilmore.

Despite my best attempts I'm unable to speak this array of languages, but as a Web developer I wanted to create the most efficient means for hosting a multi-lingual support site, and then work with native speakers to translate the English material. Because the support site runs the Zend Framework, naturally I wondered whether some sort of translation component was available, and sure enough a quick perusal of the Zend Framework website turned up Zend_Translate. In this brief tutorial I'll document how I'm using the Zend Framework to make my website available to the world.

Jason breaks up the article into two main sections - an introduction to using the Zend_Translate component and examples of it in action (including the creation of CSV files to trade out the translations.

tagged: zendframework multilingual website zendlocale zendtranslate tutorial zendframework multilingual website zendlocale zendtranslate tutorial

Link:

Developer.com:
Build Multi-lingual Websites With the Zend Framework
Jun 15, 2007 @ 18:29:54

Developer.com has a new tutorial posted today dealing with a specific use of one of the more popular PHP frameworks currently, the Zend Framework, and using it to create multi-lingual websites from Jason Gilmore.

Despite my best attempts I'm unable to speak this array of languages, but as a Web developer I wanted to create the most efficient means for hosting a multi-lingual support site, and then work with native speakers to translate the English material. Because the support site runs the Zend Framework, naturally I wondered whether some sort of translation component was available, and sure enough a quick perusal of the Zend Framework website turned up Zend_Translate. In this brief tutorial I'll document how I'm using the Zend Framework to make my website available to the world.

Jason breaks up the article into two main sections - an introduction to using the Zend_Translate component and examples of it in action (including the creation of CSV files to trade out the translations.

tagged: zendframework multilingual website zendlocale zendtranslate tutorial zendframework multilingual website zendlocale zendtranslate tutorial

Link:

Sanisoft Blog:
Multilingual apps with CakePHP
Jun 11, 2007 @ 17:33:00

On the Sanisoft blog today, there's a quick tutorial demonstrating how to create a multilingual application with the CakePHP framework:

There are basic two ways to creating a multilingual app in traditional PHP [...] CakePHP V1.2 is the framework which allows you to take the quantum leap of using gettext like functionality with minimum of hassles and at the same time address the common problems which a PHP programmer faces while creating multilingual apps.

They give an example of a simple translation of a sentence (including working with .po files). They show how to integrate the example string, create the .po file with the translation and configure the language to pull the correct phrasing to display to the page.

tagged: multilingual application cakephp gettext translate multilingual application cakephp gettext translate

Link:

Sanisoft Blog:
Multilingual apps with CakePHP
Jun 11, 2007 @ 17:33:00

On the Sanisoft blog today, there's a quick tutorial demonstrating how to create a multilingual application with the CakePHP framework:

There are basic two ways to creating a multilingual app in traditional PHP [...] CakePHP V1.2 is the framework which allows you to take the quantum leap of using gettext like functionality with minimum of hassles and at the same time address the common problems which a PHP programmer faces while creating multilingual apps.

They give an example of a simple translation of a sentence (including working with .po files). They show how to integrate the example string, create the .po file with the translation and configure the language to pull the correct phrasing to display to the page.

tagged: multilingual application cakephp gettext translate multilingual application cakephp gettext translate

Link:


Trending Topics: