News Feed
Sections




News Archive
feed this:

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

Symfony Blog:
Help Symfony reach 3 billion people
January 17, 2014 @ 11:53:02

The Symfony project wants your help to allow this popular PHP framework to reach more people all around the world (3 billion, according to them) by helping out with translations in the Validator and Security component.

Internationalization has been one of the pillars of the Symfony success since the very beginning. Besides providing tools to translate both the strings and the contents of your applications, Symfony itself is translated into a lot of different languages. [...] Some of these translations are incomplete or haven't been updated for a long time. For that reason, we are organizing a community initiative to improve the internationalization of Symfony.

The strings they're talking about are in the Validator and Security components and are currently in 20 different languages. They've broken up the ones they're needing help on into a few categories:

  • Completed translations
  • Incomplete translations
  • Unavailable translations
  • Additional translations

Obviously, they'd love ones from any of the last four in that list and they include a few steps on how to grab the latest version of Symfony and get translating.

0 comments voice your opinion now!
symfony project framework translate message validator security

Link: http://symfony.com/blog/help-symfony-reach-3-billion-people

SitePoint PHP Blog:
Using Google Translate API with PHP
October 31, 2013 @ 13:14:11

On the SitePoint PHP blog Jacek Barecki has a new tutorial showing you how to use the Google Translate API to handle the translation of dynamic input that may have come from other sources (including users).

If your site serves visitors from different countries, you may already have translated all its static content into several languages. But what to do with the content posted daily by the users in comments, opinions and ratings? As this may be as valuable a part of your site as the static content, you should think of finding a way to translate it into other languages. One service that can help is, of course, Google Translate.

He walks you through the process of setting up a Google API account (with screenshots) and how to turn on the Translate API specifically. The Translate API is not a free service, unfortunately, so you'll need to set up some billing information to use it. He then points you to where you can find your API key and shows a sample API call to get the currently supported languages. With that working, he shows you how to make an actual translation call, passing in the text and desired language on the URL and sending it to the API via curl. He also talks some about handling errors based on HTTP response code and the message returned.

0 comments voice your opinion now!
google translate api tutorial curl

Link: http://www.sitepoint.com/using-google-translate-api-php/

Michael Nitschinger:
Benchmarking Cache Transcoders in PHP
January 31, 2013 @ 11:31:01

Michael Nitschinger has written up a new post comparing a few different methods for serializing or translating objects to store them in a cache. In it, he compares the PHP serializer, the igbinary extension and translation to JSON.

Storing PHP objects (or simpler data types like arrays) in caches always requires some kind of transformation. You need a way of encoding/decoding data so that it can be stored and loaded properly. In most languages, this process is known as object serialization. PHP provides a mechanism for this out of the box, but in this article we'll also look at igbinary as a drop-in replacement for the default serializer. We also compare the results to object transcoding based on JSON, which is not really an object serialization mechanism but commonly used as a data chache structure which has its own benefits and drawbacks.

He goes through each of the three technologies and includes a snippet of code showing how they'd work in object translation. He also talks about things like the size of the result and the performance of each when the results are looped over. Based on the results of some of his "microbenchmarking" of each of the methods, igbinary came out on top, even faster than PHP's own serialize/unserialize.

0 comments voice your opinion now!
cache transcoder serialize translate object igbinary json


PHPMaster.com:
In My Language, Please! - Translating WordPress Themes and Plugins
April 23, 2012 @ 12:27:36

On PHPMaster.com there's a new tutorial showing how to use the localization support that comes with WordPress to make using different language definitions much simpler.

WordPress itself is translated to many languages and people can use it in their preferred language. But this is not the case with themes, plugins, and other front-end customizations. [...] The purpose of this article is to show you how to translate properly any theme or plugin by using internationalization and localization methods. In brief, internationalization (i18n) deals with making sure strings of text are wrapped in specific function calls.

He starts by introducing the PHP functions (and configuration) you'll need to get the localization support up and running in your plugin, including a few examples of how to translate a string. Also included into the post is an introduction to using the Poedit software to create the different translation files.

0 comments voice your opinion now!
wordpress translate poedit plugin tutorial


Lorna Mitchell's Blog:
Using iterator_to_array() in PHP
February 29, 2012 @ 08:55:52

Lorna Mitchell has a new post to her blog today showing off a lesser-known but very useful function included in PHP - the iterator_to_array function, used to translate things that implement Traversable into arrays.

Someone watching over my shoulder recently had never seen the ubiquitously-useful iterator_to_array() before. [...] Mostly I find this useful when I'm working with collections of data as these often present themselves as an object that you can foreach() over, but you can't dump it directly. If the object in question implements the Traversable interface, you can instead pass it into iterator_to_array to get the data as an array.

She includes a brief snippet of code showing it in use - transforming the results from a MongoDB cursor object back into an array.

0 comments voice your opinion now!
iterator translate array snippet traversable


SitePoint.com:
How to Create an XML to JSON Proxy Server in PHP
October 19, 2011 @ 13:07:08

On SitePoint.com today there's a new post from Craig Buckler showing you how to create a simple XML to JSON proxy server in PHP with a SimpleXML object at its heart.

Unless you're new to this web development lark, you'll know the 'X' in 'AJAX' stands for XML - eXtensible Markup Language. But you're probably not using XML. If you are, you'd probably prefer not to. All the cool kids are using JSON or JSON-P: it has a smaller payload, is easier to use and faster to process. [...] Fortunately, there are a couple of solutions which allow you to retain the benefits of XML data interchange but provide the ease of JSON in JavaScript. In this article, we're going to create an XML to JSON proxy server in PHP.

Of course, this will only work with well-formatted XML documents, but it's a quick little hack that pulls in the XML data with a curl request and parses it via SimpleXML and uses json_encode to push it back out as JSON.

0 comments voice your opinion now!
xml translate json proxy server tutorial simplexml


PHPBuilder.com:
Building a Multilingual PHP Website
September 01, 2011 @ 09: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.

1 comment voice your opinion now!
multilingual website tutorial mysql xml html translate


Derick Rethans' Blog:
Translating Twitter, part 2
June 02, 2011 @ 11:28:40

Derick Rethans has posted the second part of his look at translating twitter as a part of his PHP-GTK Twitter client Haunt. Because of the deprecation route Google chose for its translation API, he needed a change to another service - the Bing Translation API.

A while ago I wrote in an article about translating tweets in my client Haunt. For the translating itself I was using the Google Translate API, which has sadly be deprecated. Evil after all I suppose. I've now rewritten my translation code to use the Bing Translation APIs instead. You need to register an API key (see http://www.bing.com/developers/appids.aspx) to be able to use the APIs. The APIs that I am using are fairly simple though.

Also included in the post is some sample code showing how to make the request to this new API and the results from the requests.

0 comments voice your opinion now!
translate twitter haunt bing google api webservice


PHPRiot.com:
Translating Text Using the Google Translate API and PHP, JSON and cURL
May 06, 2011 @ 08:45:04

On PHPRiot.com there's a new tutorial showing you how to use the Google Translate service to translate the text of your website into any language they support. They interface with it using a cURL connection and JSON messaging.

Google Translate is a service from Google that you can use to translate text or HTML from one language to another. One of the great features of this service is that they now offer an API to let you programmatically translate text. In this article I will show you how to interact with the Google Translate API. Initially, the Google Translate API was available only via JavaScript. This has now changed, as version 2 offers a REST interface which returns translations in JSON format.

They talk about the input parameters you can give the service, the enforcement of query limits and how to handle the results that are returned. The response message is, by default, in JSON so a simple call to json_decode should be all that's needed. They've also included a sample class you can drop in and use for your translation needs (as well as sample usage code).

0 comments voice your opinion now!
google translate api json curl tutorial language


Zend Developer Zone:
Creating Multi-Language Web Applications with Zend_Translate
February 10, 2011 @ 12:03:29

On the Zend Developer Zone today there's a new tutorial they've posted looking at adding multi-language support to your applications with the help of the Zend_Translate component of the Zend Framework. It makes it simple to swap between sets of language data without much effort on your part.

If you're a Web developer building an application for global consumption, it's important for you to build in a framework for multi-language support right from the start. Fortunately, there are a number of ready-made components that can help with this task. This article will introduce you to one such component, Zend_Translate, and demonstrate how you can use it to add multi-language support to your PHP application.

There's no "magic bullet" here that'll do the translation for you, but he shows you how to set up the data for the different languages, either in PHP arrays or in translation files, that the Zend_Translate component knows how to use. He also mentions the component's ability to scan a directory tree for language files an detect the language based on a naming convention. He also mentions the "gettext" tool that you can use to generate language files based on a standard GNU format that can be used cross-language with several different tools.

There's lots of other handy bits in the tutorial so I suggest reading if you're thinking about any kind of translation for your site.

0 comments voice your opinion now!
zendtranslate zendlocale tutorial translate gettext language



Community Events





Don't see your event here?
Let us know!


composer release laravel framework introduction voicesoftheelephpant version interview update series symfony podcast library opinion language package mvc tool community security

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework