Custom PHP Localization

September 05, 2016

When building a website, you may think it only makes sense to initially focus on your local market. However, it's wise to think globally from the beginning as it is time consuming to localize your website later.


The decision to implement localization or not is tied to the nature of your website and products/services and if it's important to work with other languages and users from different locales. Many CMS's are internationalization (i18n) ready. In this blog, I will discuss the general translation processes that are platform/framework independent in PHP.

Variables Related to PHP and Design

gpi-php localization-homeIt's important to address the variables listed below related to PHP and general design:


Consider the list of target languages (bilingual, predefined set of languages or heterogeneous). Having that set, you can use the GET method to detect the language. Setting cookies and/or IP geolocation in case of query string absence. Another way to detect the language is URL rewrite.


How is your content saved? Is it dynamic (articles and news) and/or static (about us)? You might end up using two methods to handle content. First, is DB tables where you can give column lang. prefixes for easy access. The other is include files with language arrays to hold the static strings.




$lang = array();


$lang['PAGE_TITLE'] = 'ABC Page';

$lang['HEADER_TITLE'] = 'What does ABC mean?';

$lang['SITE_NAME'] = 'ABC Website';

$lang['HEADING'] = 'ABC';


$lang['MENU_HOME'] = 'Home';

$lang['MENU_ABOUT'] = 'About Us';

$lang['MENU_CONTACT'] = 'Contact Us';

$lang['MENU_SITEMAP'] = 'Site Map';



Here is a brief list of some additional variables:

  • Should you translate the URL as well? URL translation will generate multiple versions to the same URL.
  • Do any of your target languages read RTL?
  • Calendar, dates, times, currency, and numbers differ from a language to another.
  • Research aspects related to different cultures like meaning of colors, preferred navigation and layout and the use of numeric characters.
  • An important aspect of the translation process is translation itself, are you going to use machine or human translation? The first is cheaper, but the latter is much better in quality and is SEO friendly.


There are many ways to address localization and translation, your individual requirements will determine which is your best option. Each website/application is a different case with different needs and priorities, so you need to do some research before deciding on the most convenient way to implement localization and translation.

Further Resources from GPI


You may gain further insight into global e-business, global SEO and website translation and country specific cultural facts and related topics by reviewing some previous blogs written by GPI:



Please feel free to contact GPI at with any questions about our translation services.  Also let us know if you have any interesting blog topics you would like us to cover in future blogs. You may also request a complimentary Translation Quote for your projects as well.


Website Translation
PHP Localization, Website Localization, Website Translation, PHP Translation, Website Translation Best Practices

News: Milka Oreo’s Translation Error Sees Product Withdrawn in UAEEid Al Adha 2016


Currently, there are no comments. Be the first to post one!

Contact Us FREE Globalization eBooks Request Demo Request Quote

Rabab is a native Arabic speaker from Cairo, Egypt. She has over 12 years’ experience in software and websites architecture and implementation using open source programming tools including PHP, MySQL as well as jQuery, JSON and Ajax. She has served with various companies including Pyramid Technologies, Link-Dot-Net and InTouch Communications as a Programmer, Systems Engineer – Developer and Lead Web Developer. She earned her B.Sc. Degree in Economics with a minor in Computer Science from Cairo University. She completed a SSDP Diploma from the Information Technology Institute (IDSC), The Cabinet and is a certified Cloud Business Associate and a Microsoft Certified Professional (MCP, MCAD and MCSD.NET) Over the years she has designed and implemented a range of localized web-based business applications and portals for clients in the finance, hospitality, telecommunications and e-commerce sectors. In her free time she enjoys, traveling, reading, swimming, tennis and outdoor activities.