EASY PHP SITE TRANSLATION

    Rating: ★★★★☆
    View: 287
    Download: 217
    Từ khóa:

    Here’s an easy way to translate your web site using PHP. The idea is to have several files for each language you want to provide. Each one of these files have the name of the ISO code and the txt extension. For this demo I only use the german language as an alternative to the default language of the site – english. The content of these files are the words / sentences with their translation in the form:

    word=translation

    The PHP class provided will parse this file, create an array which maps both word and it’s translation pair. You just need to insert the following in your php code :

    $translate = new Translator($outputlanguage);//$outputlanguage: ISO code (example: de,en,...) --> these are the names of each file
     
    $translate->__('word to translate');

    An example:

    __('Registration'); ?>

    and in your de.txt file we would have:

    Registration=Registrierung

    loading Đang tải...

    template được ưa chuộng