Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

sql - what is the best method to build "multilingual" script in php?

I am building a website and it need to be in 7 languages? I was wondering if there is a good practice can be applied to get multilingual php script?

  • Easy for me
  • Easy for the translators

Also what do you think , should I Store it in DB , XML or in PHP file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are plenty of options for storing translations:

  • TMX: A relatively new XML format for translations. Seems to be gaining in popularity.
  • Gettext is another open format for translations. Been the de-facto standard for a long time.
  • ini files - easy to edit, very simple format
  • PHP files (arrays) - easy to edit for PHP programmers, good performance
  • CSV format - relatively simple to use.

I'd suggest you use something like Zend_Translate which supports multiple adapters and provides a basic approach to embedding translations in your application.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...