我正在开发一个包含多语言支持的网站.我可以使用 Zend_Translate 翻译字符串,但是内容呢??例如,我是否必须为每种语言为同一产品添加多条记录?或者还有其他方法吗?我是多语言新手,请帮忙.提前致谢.
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 -----------------------------
好的,我决定使用混合解决方案来使用谷歌翻译api并将其存储在数据库中以供进一步编辑.那么存储翻译的数据库结构应该是什么???
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???
我是否应该将记录保存在相关表中
should i save records in related tables
几种可能的方法:
gettext(或 Poedit 之类的软件)从内容.可以使用变量插值.gettext (or software like Poedit) to extract the data from the content. Possible with variable interpolation.似乎第三种方法需要的努力最多,但值得.
Seems the third approach requires the most efforts, but it is worth.
我假设您将产品数据存储在数据库中,例如:
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
然后您可以轻松构建 SQL 查询以提取翻译后的数据where product_id=x and language="fr".
Then you can easily build SQL queries to extract translated data where product_id=x and language="fr".
您也可以使用 Doctrine I18N 自动为你做.
You may use also Doctrine I18N to do it for you automatically.
您需要手动翻译内容(或使用 Google API 自动翻译),但是,您可以使用例如 Zend_Search_Lucene.
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.
这篇关于Zend 框架中的多语言站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
PHP、MySQL PDOException 的死锁异常代码?Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死锁异常代码?)
PHP PDO MySQL 可滚动游标不起作用PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滚动游标不起作用)
PHP PDO ODBC 连接PHP PDO ODBC connection(PHP PDO ODBC 连接)
使用 PDO::FETCH_CLASS 和魔术方法Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔术方法)
php pdo 只从 mysql 获取一个值;等于变量的值php pdo get only one value from mysql; value that equals to variable(php pdo 只从 mysql 获取一个值;等于变量的值)
MSSQL PDO 找不到驱动程序MSSQL PDO could not find driver(MSSQL PDO 找不到驱动程序)