• <bdo id='xDZcW'></bdo><ul id='xDZcW'></ul>

      <i id='xDZcW'><tr id='xDZcW'><dt id='xDZcW'><q id='xDZcW'><span id='xDZcW'><b id='xDZcW'><form id='xDZcW'><ins id='xDZcW'></ins><ul id='xDZcW'></ul><sub id='xDZcW'></sub></form><legend id='xDZcW'></legend><bdo id='xDZcW'><pre id='xDZcW'><center id='xDZcW'></center></pre></bdo></b><th id='xDZcW'></th></span></q></dt></tr></i><div id='xDZcW'><tfoot id='xDZcW'></tfoot><dl id='xDZcW'><fieldset id='xDZcW'></fieldset></dl></div>
      <legend id='xDZcW'><style id='xDZcW'><dir id='xDZcW'><q id='xDZcW'></q></dir></style></legend>
    1. <small id='xDZcW'></small><noframes id='xDZcW'>

      <tfoot id='xDZcW'></tfoot>

      1. Zend 框架中的多语言站点

        时间:2023-05-30
        <i id='Owna4'><tr id='Owna4'><dt id='Owna4'><q id='Owna4'><span id='Owna4'><b id='Owna4'><form id='Owna4'><ins id='Owna4'></ins><ul id='Owna4'></ul><sub id='Owna4'></sub></form><legend id='Owna4'></legend><bdo id='Owna4'><pre id='Owna4'><center id='Owna4'></center></pre></bdo></b><th id='Owna4'></th></span></q></dt></tr></i><div id='Owna4'><tfoot id='Owna4'></tfoot><dl id='Owna4'><fieldset id='Owna4'></fieldset></dl></div>

          <small id='Owna4'></small><noframes id='Owna4'>

          <tfoot id='Owna4'></tfoot>
          • <bdo id='Owna4'></bdo><ul id='Owna4'></ul>
            <legend id='Owna4'><style id='Owna4'><dir id='Owna4'><q id='Owna4'></q></dir></style></legend>

              <tbody id='Owna4'></tbody>

                  本文介绍了Zend 框架中的多语言站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个包含多语言支持的网站.我可以使用 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???

                  1. 我是否应该将不同语言的翻译保存在与父记录相同的表中.即对于产品表中的产品,在标识语言中有一个额外的列.
                  2. 一个通用的单个表,用于存储所有表的所有翻译.例如翻译(id bigint、table_name vc(50)、table_id bigint、langugae、column_name vc(50)、translation)

                  我是否应该将记录保存在相关表中

                  should i save records in related tables

                  推荐答案

                  几种可能的方法:

                  1. 使用 gettext(或 Poedit 之类的软件)从内容.可以使用变量插值.
                  2. 创建视图过滤器,如:Zend 框架和翻译
                  3. 在数据库中有单独的数据内容.
                    如果您以标记(例如 Markdown)格式存储内容,则任何人都可以轻松翻译它.创建不同语言的搜索引擎很容易.
                  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.

                  我假设您将产品数据存储在数据库中,例如:

                  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 框架中的多语言站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Zend_Cache:加载缓存数据后,字符编码好像乱了 下一篇:Zend Framework 1 与 Zend Framework 2 性能对比

                  相关文章

                1. <tfoot id='3iSlS'></tfoot>
                  <legend id='3iSlS'><style id='3iSlS'><dir id='3iSlS'><q id='3iSlS'></q></dir></style></legend>

                  <small id='3iSlS'></small><noframes id='3iSlS'>

                        <bdo id='3iSlS'></bdo><ul id='3iSlS'></ul>
                      <i id='3iSlS'><tr id='3iSlS'><dt id='3iSlS'><q id='3iSlS'><span id='3iSlS'><b id='3iSlS'><form id='3iSlS'><ins id='3iSlS'></ins><ul id='3iSlS'></ul><sub id='3iSlS'></sub></form><legend id='3iSlS'></legend><bdo id='3iSlS'><pre id='3iSlS'><center id='3iSlS'></center></pre></bdo></b><th id='3iSlS'></th></span></q></dt></tr></i><div id='3iSlS'><tfoot id='3iSlS'></tfoot><dl id='3iSlS'><fieldset id='3iSlS'></fieldset></dl></div>