开发者

Multilingual Site in Zend Framework

i am working on a site to include Multilingual Support. I can translate strings using Zend_Translate but what about the content?? For example do i have to add multiple records for same product's for each language? Or is there any other way? I am new to multilingual please help. Thanks in advance.

--- Addition -----------------------------

Ok, i decided to use a mixed solution to use google translation api and storing it in database for further editing. So what sould be the structure of database to store translations???

  1. Should i save translations of different language in same table as parent record. i.e. for product in product table with an extra column to identity language.
  2. A generalized single table to store all translations开发者_如何学JAVA of all tables. e.g. translations (id bigint,table_name vc(50),table_id bigint, langugae, column_name vc(50), translation )

should i save records in related tables


Few possible approaches:

  1. Using gettext (or software like Poedit) to extract the data from the content. Possible with variable interpolation.
  2. Creating view filter like described in: Zend Framework and Translation
  3. Have separate content of the data in the database.
    If you store the content in markup (e.g. Markdown) format, anyone can translate it easily. It's easy to create search engine in different languages.

Seems the third approach requires the most efforts, but it is worth.

Update after comment

I assume you store your product data in the database, in fields like:

- product_data
-- id
-- price
-- name
-- description
-- etc…

So you should modify it, to add fields for translated strings in each language:

- product_data
-- id
-- price

- product_data_translations
-- product_id
-- language (e.g. en)
-- name
-- description
-- etc

Then you can easily build SQL queries to extract translated data where product_id=x and language="fr".

You may use also Doctrine I18N to do it for you automatically.

You need to translate the content manually (or automate the translation using Google API), but then, you can easily index it using for example Zend_Search_Lucene.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜