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

Categories

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 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

See Question&Answers more detail:os

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...