Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...