How does php develop multilingual websites?

Source: Internet
Author: User
I am a beginner in php and want to use PHP to develop a multi-language website. Which of the following methods can you use to develop a multi-language website? I checked some information and found 2 methods 1. The multi-language part will be involved and the variable ID will be used. 2. Is there any other way to use the gettext extension? How do you develop multilingual websites. Thanks ------ solution ------------------ the multi-language section will be involved. use the variable label to ask php how to develop a multi-language website
I am a beginner in PHP and want to use PHP to develop a multi-language website,
I would like to ask you which of the following is the best way to get started and show good results
Method?

I checked some information and found two methods.
1. The multi-language part will be involved and the variable ID will be used.
2. Use gettext extension
Are there other methods? When developing multilingual websites
How to do it.

Thanks

------ Solution --------------------
The multi-language part will be involved and the variable ID will be used

1. generate a template and make the multilingual part variable.
2. generate a multi-template language pack.
3. when the program is executed, obtain the current language first, then obtain the language pack, replace the variables in the template, and then output.
------ Solution --------------------
Use i18.php to create. po and. mo files in a browser. multiple languages are supported!
------ Solution --------------------
100 points. let's get together and summarize all the above, even for example.
All characters are defined as variables.
For example: $ menu_index.
There are multiple language packs in multiple languages that can be used as configuration files, such as en. inc. php cn. inc. php.
The content is as follows:

Cn. inc. php
$ Menu_index = 'homepage ';
$ Menu_aboutus = 'about ours ';

En. inc. php
$ Menu_index = 'index ';
$ Menu_about_us = 'about _ us ';

When adding content in the background, it is better to split the content of various languages into databases.
Administrators in different languages can connect to different databases.
You can also classify the table name cn_news en_news.
------ Solution --------------------
Multi-language packages are used during design,
Use HTTP_ACCEPT_LANGUAGE of php to obtain the local language. Include the corresponding language pack

Actually, it's quite simple.
------ Solution --------------------
The function is divided into functions as described on the first floor:
1. multi-language arrays or class variables
2. create a template to include these variables
3. generate a program based on this template to generate static data.
------ Solution --------------------
Discussion
The multi-language part will be involved and the variable ID will be used

1. generate a template and make the multilingual part variable.
2. generate a multi-template language pack.
3. when the program is executed, obtain the current language first, then obtain the language pack, replace the variables in the template, and then output.

------ Solution --------------------
The final analysis is to manage multiple language resources in a unified manner,
Call the corresponding language information based on the HTTP request information or the server setting information.

Generally divided:
1. Lenovo array management in the global domain
2. directly use quantitative management by calling files in different languages
3. it is also an array in global, but the language resources are managed by external files (such as ini), and the program automatically generates an array.
------ Solution --------------------
I don't know the specific idea of LZ.

Multi-language interface is relatively simple. We recommend that you use the standard gettext method.

We recommend that you have a complete introduction: http://plog.longwin.com.tw/programming/2007/09/16/gettext_php_i18n_2007. Of course, he also cited my article, but because of my WP revision, the article id has changed:

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

Hope to help you.
------ Solution --------------------
Reference the post of wqlzju:
I am a beginner in PHP and want to use PHP to develop a multi-language website,
I would like to ask you which of the following is the best way to get started and show good results
Method?

I checked some information and found two methods.
1. The multi-language part will be involved and the variable ID will be used.
2. Use gettext extension
Are there other methods? When developing multilingual websites
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.