Search code examples
phpmysqllanguage-translation

Translations for non dynamic data


I am currently making a web page with dynamic content from a database (a restaurant menu) storing item names, prices, yada yada. The restaurant usually caters to English and Japanese. I have stored the titles of the items in the database as English and Japanese, however when it comes to the type of the item, for example, Type: Drink, Type of Drink: Coffee I can obviously store the type of item alongside the item in the database, but it hardly seems worth it to store it twice as two different languages in the the database which would also make the form to add a new item a pain.

What is the best way to go about translating those little tiny pieces of information, like "Coffee", "Wine", "Click Here", "Menus", and using them on the page?


Solution

  • You can use gettext extension for translation static or predefined info on web page.

    See manual http://php.net/manual/en/book.gettext.php

    Example http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/