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

SitePoint PHP Blog:
Easy Multi-Language Twig Apps with Gettext
Apr 14, 2016 @ 12:55:08

The SitePoint PHP blog has a post from editor Bruno Skvorc showing you how to integrate gettext with Twig to make it easier to internationalize your application with multiple languages and strings.

There are many approaches for adding new languages to your application’s UI. Though some userland solutions like symfony/translation are arguably simpler to use, they’re slower than the good old native gettext by an order of several magnitudes.

In this tutorial, we’ll modify an English-only application to use gettext. Through this, we’ll demonstrate that getting internationalization up and running in an already existing app is not only possible, but relatively easy.

He starts with some of the bootstrapping you'll need to do to get the "nofw" project up, Twig installed and them hooked together. He briefly introduces gettext and how it's used in PHP (with the _() handling) and provides an example defining a locale and the language files to match. He shows how to generate the .pot files, add a new language and the code needed to hook in the Twig_Extensions_Extension_I18n extension. The post ends with some "bonus scripts" to help make things a bit simpler: bash scripts to hide some of the complexity of the process.

tagged: tutorial gettext internationalization i18n multilanguage language locale

Link: http://www.sitepoint.com/easy-multi-language-twig-apps-with-gettext/

SitePoint PHP Blog:
Fast Multi-language Docs with SitePoint’s RTDSphinx-PHP
Sep 09, 2015 @ 12:42:50

The SitePoint PHP blog has a tutorial posted showing you how to create multi-language documentation with ReadTheDocs and Sphinx with the help of the RTDSphinx-PHP library.

This post will guide you through getting up and running with RTDSphinx-PHP, a ReadTheDocs-friendly Sphinx based PHP documentation skeleton with sane defaults, pre-installed directives, and modified styles for optimal API and prose documentation rendering in multiple languages. For an unfinished example of the documentation, see here and switch the language in the bottom left flyout panel.

If this sounds familiar, it’s because we already went through a manual setup of a similar skeleton in a previous post, but that one had no localization support, too many steps, and wasn’t as reusable as this newly developed one.

He starts with the "quickstart" instructions to help you get the necessary tools installed to create the documentation. From there he gets into some of the main features the library provides including localization, a few utility scripts and syntax highlighting. Each of these comes with a bit of code/markup showing how to put them to use. The post ends with the instructions you'll need to push the documentation you've created up to ReadTheDocs and what the results should look like.

tagged: documentation multilanguage language readthedocs sphinx library

Link: http://www.sitepoint.com/fast-multi-language-docs-with-sitepoints-rtdsphinx-php/

SitePoint PHP Blog:
Implementing Multi-Language Support
Apr 16, 2014 @ 12:18:39

The SitePoint PHP blog has a new post from Jacek Barecki talking about a few ways you can include multi-language support in your PHP applications. There's not much in the way of actual code here, but there are links to some other tools that can help get the job done.

Setting up a multilingual site may be a good way to attract new customers to your business or gain more participants in your project. Translating a simple site with a few static pages probably won’t probably be complicated, but more complex PHP web applications may require a lot of work when launching multiple language support. In this article I’ll present different types of content that need to be taken under consideration when internationalizing a site.

He breaks it down into five different types of content that you might want to translate:

  • Multi-language Static Content
  • Database content
  • User submitted content
  • Resources (images, videos, etc)
  • Other types of content

He wraps it up with a few recommendations including making a checklist of the things you want to translate to figure out what tools you need to use.

tagged: multilanguage support implementation content type

Link: http://www.sitepoint.com/implementing-multi-language-support/

PHPMaster.com:
Multi-Language Support in CodeIgniter
Apr 04, 2013 @ 12:52:02

New on PHPMaster.com there's a tutorial by Rakhitha Nimesh about using the multi-language support to CodeIgniter applications. This functionality is included as a default part of the framework using internal language files.

Multi-language support, also known as internationalization, is a key feature of modern web applications. Most of the full-stack PHP frameworks come with multi-language support which enables us to dynamically present our application’s interface in different languages without duplicating the existing source code for each language. Today we’re going to discuss how we can enable multiple languages using CodeIgniter as well as a few tricks to customize the core functionality.

He shows where in the configuration to set the default language and where you'll need to put the language files so CodeIgniter can find them. Sample code shows how to load in the language files and how to pass certain values out to the view for display. He also includes an example of using CodeIgniter's own hooks system to call the language file load via a "LanguageLoader" class after the controller instance is created.

tagged: codeigniter tutorial multilanguage language file

Link: http://phpmaster.com/multi-language-support-in-codeigniter/

CodeForest.net:
Multilanguage support in Zend Framework
Sep 06, 2011 @ 12:27:40

In a new post over on CodeForest.net there's a guide from Zvonko Biskup about using the multi-language support in the Zend Framework, specifically implementing gettext support.

We can not imagine a modern web application without a multi language support. I will show you how easy it is to setup usage of multiple languages in Zend Framework and how to setup some basic language routes (handy for SEO stuff). The Zend Framework offers many ways for you to store your translated strings. It could be an array, a CSV or XML file or you could use gettext which we will be using today.

He introduces the topic by answering the question "why gettext?" with two reasons - the simplicity of editing the gettext files and the fact that Apache caches the resulting ".mo" files. He includes the code to set up a Zend_Translate object in your bootstrap and calling the "translate()" method in your views to handle the hard work. He briefly touches on using PoEdit to work with the gettext files and how to drop those into your ZF application's structure to make them available. Finally, he sets up some automatic routing you can easily use to switch languages based on something like a cookie or session value.

tagged: multilanguage zendframework gettext poedit tutorial

Link:

Robert Basic's Blog:
A hack for Zend Framework’s translated route segments
Apr 15, 2011 @ 09:17:40

Robert Basic has put together a new post to his blog about a hack he's found for the Zend Framework translated route segments when a "gotcha" popped up when he was trying to use them in a multi-language website.

The web site’s default locale, language, is English. If the user has no locale in the session/cookie, she, or he, will get the English version of the web site. [...] But! If the user’s first visit is on the http://example.com/vesti URL ("vesti" is "news" in Serbian), the router can’t route that because it depends on the locale and the default locale is English and not Serbian, thus directing the user to the 404 page.

To get around this issue he created a front controller plugin that fires in the postDispatch hook to change the locale manually if the current request's isn't found to be English. It then redirects the user to the correct location for the new language and things proceed normally.

tagged: zendframework hack multilanguage route segment issue

Link:

Community News:
Komodo IDE 4.0 Released
Jan 24, 2007 @ 09:45:00

As mentioned by both Sean Coates and the International PHP Magazine, ActiveState has release the latest version of their popular development environment - Komodo IDE 4.0.

Komodo IDE 4.0 is the first unified workspace for end-to-end development of dynamic web applications. A rich feature set for client-side Ajax languages such as CSS, HTML, JavaScript and XML, coupled with advanced support for dynamic languages such as Perl, PHP, Python, Ruby and Tcl, enables developers to quickly and easily create robust web apps.

Komodo is all about simplicity and helping you write your code. This includes features like a multi-language editor, integrating sharing abilities, the ability to create Firefox-like extensions to add to other applications, and full customization settings to make your worspace your own.

Find out more about the software on Komodo's page or just head over and buy this latest version for a discounted rate of $245 USD. There's also a trial copy you can download and check out before spending the cash.

tagged: komodo release multilanguage editor ide sharing extension komodo release multilanguage editor ide sharing extension

Link:

Community News:
Komodo IDE 4.0 Released
Jan 24, 2007 @ 09:45:00

As mentioned by both Sean Coates and the International PHP Magazine, ActiveState has release the latest version of their popular development environment - Komodo IDE 4.0.

Komodo IDE 4.0 is the first unified workspace for end-to-end development of dynamic web applications. A rich feature set for client-side Ajax languages such as CSS, HTML, JavaScript and XML, coupled with advanced support for dynamic languages such as Perl, PHP, Python, Ruby and Tcl, enables developers to quickly and easily create robust web apps.

Komodo is all about simplicity and helping you write your code. This includes features like a multi-language editor, integrating sharing abilities, the ability to create Firefox-like extensions to add to other applications, and full customization settings to make your worspace your own.

Find out more about the software on Komodo's page or just head over and buy this latest version for a discounted rate of $245 USD. There's also a trial copy you can download and check out before spending the cash.

tagged: komodo release multilanguage editor ide sharing extension komodo release multilanguage editor ide sharing extension

Link: