 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
SitePoint.com: How to Create an XML to JSON Proxy Server in PHP
by Chris Cornutt 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.
voice your opinion now!
xml translate json proxy server tutorial simplexml
PHPBuilder.com: Building a Multilingual PHP Website
by Chris Cornutt 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.
voice your opinion now!
multilingual website tutorial mysql xml html translate
PHPRiot.com: Translating Text Using the Google Translate API and PHP, JSON and cURL
by Chris Cornutt 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).
voice your opinion now!
google translate api json curl tutorial language
Zend Developer Zone: Creating Multi-Language Web Applications with Zend_Translate
by Chris Cornutt 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.
voice your opinion now!
zendtranslate zendlocale tutorial translate gettext language
Reddit.com: What are the most popular (or best) methods to translate a PHP-built website?
by Chris Cornutt December 30, 2010 @ 10:42:28
In this new post from Reddit.com a question is asked about website translations and the opinions on best practices for it.
I'm just curious what the best practices are for translating your website into another language, to present foreign readers with text in their home lingua -- well, particularly if there are PHP-specific methods to do so. I've stumbled across the pages for GNU gettext and that seems interesting, but I'm curious what people think of it.
Suggestions include manual translation via a human, use a text substitution method two swap out content versions based on language, using language files (and some opinions from others on which of these approaches might work best).
voice your opinion now!
translate website bestpractice gettext
CodeForest.net: Translate and Localize your web application with PHP and gettext
by Chris Cornutt October 06, 2010 @ 10:45:29
On CodeForest today there's a new tutorial showing you how to localize your application with the help of the gettext functionality PHP offers or just simple arrays.
Wikipedia says: Localization is the process of translating a product into different languages or adapting a language for a specific country or region. There are several techniques that developer can use to localize an application. The most common ones are using arrays and gettext. I will try to explain both and how to use them.
They provide code examples for each method - arrays containing literal strings matching one-for-one with their English counterparts and the gettext method where language files are created and handled outside of the codebase. Gettext does require support to be loading into your installation (might not be by default).
voice your opinion now!
tutorial translate application gettext array
|
Community Events
Don't see your event here? Let us know!
|