What is the best way to translate PHP projects?

Asked

Viewed 107 times

0

I finished a course site these days, and one of the requirements was to have support for at least 3 languages, after searching a while I saw that a very recommended method was to create the same array in separate files, same keys, changing only the value of each key, and give the include depending on the selected language (I cookie).

My question is, was that really the best method? My project was not there this giant monster, but it gave a tiring call every word or phrase as array in every file of it.

  • 2

    There is no specific solution that is "the right one" because the best way depends on the project. That’s why the closing vote is "based on opinion".

  • 1

    @Danielomine is right, everything will depend on how the project will be forwarded, many frameworks have libraries, or even own procedures to internationalize the sites.

1 answer

0

You must use the php-gettext with file support . po or . pot, similar to what is done in Wordpress. See this guide:

http://www.devin.com.br/php-gettext/
  • While this link may answer the question, it is best to include the essential parts of the answer here and provide the link for reference. Replies per link only can be invalidated if the page with the link is changed. - Of Revision

  • The answer is indicating the technology sought by the user directly. The link is only complementing the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.