How does PHP develop multi-lingual website

Source: Internet
Author: User
Ask PHP How to develop multi-lingual website
I am a novice php, want to use PHP to develop a multi-lingual website,
Please ask you what kind of shrimp to get started and show the effect of good
Method?

I looked up some information and found 2 ways.
1. will involve multi-language parts, using variable identifiers.
2. Using GetText extensions
Is there any other way? When you are developing a multilingual website, you are
How to do it.

Thanks

------Solution--------------------
will involve multi-language parts, using variable identifiers

1 Create a template to make a multi-language part variable.
2 Create a multi-template language pack.
3 when the program executes, get the current language, then get the language pack, replace the variables in the template, and then output.
------Solution--------------------
GetText extension, use i18.php to build. po,.mo files in the browser language, support multiple languages!
------Solution--------------------
100 points, come to gather a lively, the above are summed up, and then I illustrate.
All occurrences of a character are defined as variables.
For example: $menu _index.
Multiple languages have multiple language packs, which can be made into configuration files, such as en.inc.php cn.inc.php, etc.
The contents are as follows:

cn.inc.php
$menu _index= ' home ';
$menu _aboutus= ' About us ';

en.inc.php
$menu _index= ' index ';
$menu _about_us= ' About_us ';

Background Add the time, the various languages of the content of the library is better.
Different languages of the administrator background, connected to different databases.
or classify the name of the table Cn_news en_news
------Solution--------------------
Design time with multi-language package,
Use PHP's http_accept_language to get the local language. Include the appropriate language pack

It's pretty simple, actually.
------Solution--------------------
Divide the function into something like the 1 floor says:
1, multi-language arrays or class variables
2, make a template, put these variables into the inside
3, follow this template to build a program, generate static can be
------Solution--------------------
discuss
will involve multi-language parts, using variable identifiers

1 Create a template to make a multi-language part variable.
2 Create a multi-template language pack.
3 when the program executes, get the current language, then get the language pack, replace the variables in the template, and then output.

------Solution--------------------
In the final analysis, it is to unify various language resources and manage them.
The appropriate language information is invoked based on the HTTP request information or the server settings information.

Broadly divided into:
Using associative array management under 1.global domain
2. Direct use of quantitative management by invoking different language files
3. Also an array under global, but the language resource is managed by an external file (such as INI), and the program automatically generates an array
------Solution--------------------
Don't know the specific idea of LZ.

If the language is limited to the interface, it is more simple. I suggest handling it in a gettext standard way.

Suggest you look here a more complete introduction: http://plog.longwin.com.tw/programming/2007/09/16/gettext_php_i18n_2007. Of course, he also quoted my article, but because of my WP revision, the article ID has changed:

http://www.rsywx.net/wordpress/2007/07/161

Hope to be of help to you.
------Solution--------------------
cite the landlord Wqlzju post:
I am a novice php, want to use PHP to develop a multi-lingual website,
Please ask you what kind of shrimp to get started and show the effect of good
Method?

I looked up some information and found 2 ways.
1. will involve multi-language parts, using variable identifiers.
2. Using GetText extensions
Is there any other way? When you are developing a multilingual website, you are
How to do it.

Thanks
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.