(13)odoo翻譯


-------------------
更新時間:
15:52 2016-09-28 星期三 增加模型名翻譯
17:26 2016-05-20 星期五
17:58 2016-05-17 星期二
12:14 2016-02-24 星期三
-------------------
* 翻譯概述:
    每個模塊都可以提供自己的翻譯文件,存放在i18n(其來源是英文單詞 internationalization的首末字符i和n,
    18為中間的字符數)目錄下,文件名為LANG.po LANG為語言,如中文簡體 zh_CN.po
   
  │- stock #模塊
  │    │- i18n #翻譯目錄
  │    │    │- stock.pot #翻譯模板
  │    │    │- zh_CN.po  #中文簡體
  │    │    │- (..).po  #其它語言翻譯文件
 
 
* 翻譯支持的類型
    /openerp/addons/base/ir/ir_translation.py
   
    ('field', 'Field'),  字段
    ('model', 'Object'),  模型
    ('rml', 'RML  (deprecated - use Report)'), # Pending deprecation - to be replaced by report! 以前的報表
    ('report', 'Report/Template'), 報表
    ('selection', 'Selection'), 選擇項
    ('view', 'View'), 視圖
    ('wizard_button', 'Wizard Button'), 向導按鈕
    ('wizard_field', 'Wizard Field'), 向導字段
    ('wizard_view', 'Wizard View'), 向導視圖
    ('xsl', 'XSL'), 表格
    ('help', 'Help'), 幫助
    ('code', 'Code'), 代碼
    ('constraint', 'Constraint'), 自定義約束
    ('sql_constraint', 'SQL Constraint')   sql約束
   
*  /addons/web/i18n
    這里要把 zh_CN.po 復制一份 命名為zh.po
    這樣這個目錄下 有 zh_CN.po  zh.po  這兩個文件
    主要解決了數據庫管理界面不能翻譯的bug   


* 翻譯方法
=================================代碼類開始===================================
    @python代碼片段中的翻譯
        #. module: stock
        #: code:addons/stock/stock.py:1677
        #, python-format
        msgid " (%s reserved)"
        msgstr " (%s 被保留)"
       ------
       addons/stock/stock.py
       info += _(' (%s reserved)') % str(reserved_available)
       -------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: code:addons/stock/stock.py:1677
                格式為 #: code:python代碼相對根目錄的文件名:第幾行(相差幾行沒關系)  
                注意一下code:addons... 一般第三方代碼不會放在addons下
                一般新建一個目錄 addonscustom ,這時這里要相應的更改
        第三行     #, python-format  是python代碼,這個照寫就可以
        可以看到代碼中可以翻譯的字符,都用 _()引起來了
        注:對應的python 要導出翻譯模塊:
        from openerp.tools.translate import _

    @ 彈出窗體提醒翻譯
        #. module: stock
        #: code:addons/stock/stock.py:3922
        #, python-format
        msgid "Warning: wrong UoM!"
        msgstr "警告!錯誤的計量單位!"   
        -----------
        if selected_uom.category_id.id != product.uom_id.category_id.id:
                res['warning'] = {
                    'title': _('Warning: wrong UoM!'),
                    'message': _('The selected UoM for product %s is not compatible with the UoM set
                      on the product form. \nPlease choose an UoM within the same UoM category.') % (product.name)
                }
        -----------           
       
    @js代碼片段的翻譯   
        #. module: web
        #. openerp-web
        #: code:addons/web/static/src/js/chrome.js:279
        #, python-format
        msgid "Ok"
        msgstr "確定"
        ------
        addons/web/static/js/chrome.js/chrome
       
       {text: _t("Ok"), click: function() { this.parents('.modal').modal('hide'); }}
        -------
        第一行  #. module: web   格式為 #. module: 模塊的目錄名
        第二行  #. openerp-web   這個固定的頁面模塊
        第三行  #: code:addons/web/static/src/js/chrome.js:279
                格式為 #: code:js代碼相對根目錄的文件名:第幾行(相差幾行沒關系)  
                注意一下code:addons... 一般第三方代碼不會放在addons下
                一般新建一個目錄 addonscustom ,這時這里要相應的更改
        第四行     #, python-format   這個照寫就可以
        可以看到代碼中可以翻譯的字符,都用 _t()引起來了
       
    @xml代碼中的翻譯,這里指 /static/下面的
        #. module: web_graph
        #. openerp-web
        #: code:addons/web_graph/static/src/xml/web_graph.xml:23
        #, python-format
        msgid "Heat Map"
        msgstr "熱圖"   
        ----
        addons/web_graph/static/src/xml/web_graph.xml:
       
          <label class="btn btn-default" data-mode="both" title="Heat Map">
        ----
        第一行  #. module: web_graph   格式為 #. module: 模塊的目錄名
        第二行  #. openerp-web   這個固定的頁面模塊
        第三行  #: code:addons/web_graph/static/src/xml/web_graph.xml:23
                格式為 #: code:js代碼相對根目錄的文件名:第幾行(相差幾行沒關系)  
                注意一下code:addons... 一般第三方代碼不會放在addons下
                一般新建一個目錄 addonscustom ,這時這里要相應的更改
        第四行     #, python-format   這個照寫就可以
        可以看到代碼中可以翻譯的字符,這里是title的值 ,也可以是<p>...</p>中的內容
       

=================================代碼類結束===================================   

=================================字段名類開始=================================       
       
    @字段翻譯
        #. module: stock
        #: field:stock.warehouse,partner_id:0
        msgid "Address"
        msgstr "地址"
        ------
        addons/stock/stock.py
       
        class stock_warehouse(osv.osv):
        _name = "stock.warehouse" #模型名
        _description = "Warehouse"

        _columns = {
            ...
            'partner_id': fields.many2one('res.partner', 'Address'),
            ...
        }
       --------
       stock_view.xml 對應的視圖顯示
        <record id="view_warehouse_tree" model="ir.ui.view">
            <field name="name">stock.warehouse.tree</field>
            <field name="model">stock.warehouse</field>
            <field name="arch" type="xml">
                <tree string="Warehouse">
                    <field name="name"/>
                    <field name="lot_stock_id" groups="stock.group_locations"/>
                    <field name="partner_id"/>
                </tree>
            </field>
        </record>
      -----------   
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: field:stock.warehouse,partner_id:0
                格式為 #: field:模型名:要翻譯的字段名:0
        partner_id 是在數據表中字段
        Address 在顯示名稱
       
    @ 字段幫助翻譯
        #. module: stock
        #: help:stock.config.settings,group_uom:0
        msgid "Allows you to select and maintain different units of measure for products."
        msgstr "允許你選擇和維護產品的不同計量單位"
        ------
        res_config.py
        class stock_config_settings(osv.osv_memory):
        _name = 'stock.config.settings'
        _inherit = 'res.config.settings'

        _columns = {
            ...
            'group_uom': fields.boolean("Manage different units of measure for products",
                implied_group='product.group_uom',
                help="""Allows you to select and maintain different units of measure for products."""),
            ...
        -------   
        res_config_view.xml
        <record id="view_stock_config_settings" model="ir.ui.view">
            <field name="name">stock settings</field>
            <field name="model">stock.config.settings</field>
            <field name="arch" type="xml">
            ...
                   <div>
                            <field name="group_uom" class="oe_inline"/>
                            <label for="group_uom"/>
                   </div>
            ...
         ----------
            第一行  #. module: stock  格式為 #. module: 模塊的目錄名
            第二行  #: help:stock.config.settings,group_uom:0
                    格式為 #: help:模型名,字段名
                   
=================================字段名類結束==============================
=================================約束開始==============================

    @條件約束中文翻譯
   
        #. module: account
        #: constraint:account.move.line:0
        msgid "Account and Period must belong to the same company."
        msgstr "帳戶和帳期必須屬於同一家公司。"
       
        ----------------
        addons/account/account_move_line.py
        class account_move_line(osv.osv):
            _name = "account.move.line"
            ....
            def _check_company_id(self, cr, uid, ids, context=None):
                lines = self.browse(cr, uid, ids, context=context)
                for l in lines:
                    if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:
                        return False
                return True
            ....   
            _constraints = [
                 ...
                (_check_company_id, 'Account and Period must belong to the same company.', ['company_id']),
                ...
        -------------------
        第一行  #. module: account   格式為 #. module: 模塊的目錄名
        第二行  #: constraint:account.move.line:0
                格式為 #:constraint:模型名:0
        第三行    msgid "Account and Period must belong to the same company."
                要翻譯的字符串       
       
       
    @sql 字段約束中文翻譯
   
        #. module: account
        #: sql_constraint:account.move.line:0
        msgid "Wrong credit or debit value in accounting entry !"
        msgstr "錯誤的出納會計分錄"
        ----------------------     
        addons/account/account_move_line.py
        class account_move_line(osv.osv):
            _name = "account.move.line"
            ....

          _sql_constraints = [
              ('credit_debit1', 'CHECK (credit*debit=0)',  'Wrong credit or debit value in accounting entry !'),   
        ---------------------   
        第一行  #. module: account   格式為 #. module: 模塊的目錄名
        第二行  #: sql_constraint:account.move.line:0
                格式為 #:sql_constraint:模型名:0
        第三行    msgid "Wrong credit or debit value in accounting entry !"
                要翻譯的字符串
       
=================================字段約束結束==============================

    @ 下拉選擇內容翻譯   
        #. module: stock
        #: selection:stock.move,state:0
        msgid "Available"
        msgstr "可用"
        --------
        stock.py
        class stock_move(osv.osv):
        _name = "stock.move"
        _description = "Stock Move"
        ...
        _columns = {
        ...
          'state': fields.selection([('draft', 'New'),
                                   ('cancel', 'Cancelled'),
                                   ('waiting', 'Waiting Another Move'),
                                   ('confirmed', 'Waiting Availability'),
                                   ('assigned', 'Available'),
                                   ('done', 'Done'),
                                   ], 'Status', readonly=True, select=True, copy=False,
        ...
       
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: selection:stock.move,state:0
                格式為 #:selection:模型名,字段名
        第三行    msgid "Available" 下拉選擇項的顯示名稱
   
    @ xsl 文件中文翻譯
   
        <report
            id="account_transfers"
            model="account.transfer"
            name="account.transfer"
            string="Transfers"
            xml="account/report/transfer.xml"
            xsl="account/report/transfer.xsl"
        />
       
        #. module: account
        #: xsl:account.transfer:0
        msgid "Document"
        msgstr "單據"   
       
        --------------
        addons/account/report/transfer.xsl:
       
        <para>
        <b t="1">Document</b>: <i><xsl:value-of select="name"/></i>
        </para>
        --------------
        第一行  #. module: account   格式為 #. module: 模塊的目錄名
        第二行  #: xsl:account.transfer:0
                格式為 #:xsl:xsl文件對應的名字空間:0 這里取 name="account.transfer"
                這時你要搜索文件名對應定義的 report
        第三行    msgid "Document" xsl文件出現要翻譯的字符串       
       

=================================報表類開始=================================

    @ 報表界面翻譯
        報表動作定義:
        class ir_actions_report_xml(osv.osv):
            _name = 'ir.actions.report.xml'
            _inherit = 'ir.actions.actions'
            _table = 'ir_act_report_xml'
   
   
        #. module: stock
        #: model:ir.actions.report.xml,name:stock.action_report_lot_barcode
        msgid "Lot BarCode"
        msgstr "批次條形碼"
        ----------
        stock_report.xml
        <report id="action_report_lot_barcode" model="stock.production.lot"
           report_type="qweb-pdf" name="stock.report_lot_barcode"
           string="Lot BarCode" file="stock.report_lot_barcode"/>
        --------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: model:ir.actions.report.xml,name:stock.action_report_lot_barcode
                格式為 #: model:ir.actions.report.xml,name:模塊的目錄名.記錄外部標識符
                name 對應的是 string 和往常有點差別, 上面xml中的name, 則映射到數據表中
                report_name 指要采用哪個模板文件
                記錄外部標識符 這里很顯然是 報表id
        第三行    msgid "Lot BarCode" 報表里的string 內容拷貝出來翻譯   
        <report><report>是 <record id="###" model="ir.actions.report.xml">...</record>
        只是在定義紙章時,不能用簡標簽
       
    @報表模板中的中文翻譯   
        #. module: stock
        #: view:website:stock.report_lot_barcode
        msgid "Lot"
        msgstr "批次"
       
        --------------
        addons/stock/views/report_lot_barcode.xml
        報表模板
        <template id="report_lot_barcode">
                ........
                                    <tr>
                                        <th>Product</th>
                                        <th>Lot</th>
                                    </tr>
                .......
        </template>   
        --------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: view:website:stock.report_lot_barcode
                格式為 #: view:webiste:模塊的目錄名.記錄外部標識符(模板id)   
               
        第三行  msgid "Lot"  把模板對應要翻譯的字符復制過來
       
        --------
       
       
   @rml文件內中文的翻譯
  
        <data>
           
            <report auto="False" id="ir_module_reference_print"
                model="ir.module.module" name="ir.module.reference"
                rml="base/module/report/ir_module_reference.rml"
                string="Technical guide"/>
           
        </data>
   
       
        #. module: base
        #: report:ir.module.reference:0
        msgid "Menu :"
        msgstr "菜單:"
        -----------
        openerp/addons/base/module/report/ir_module_reference:
       
        <para style="terp_default_8_underline">Menu :</para>
        ----------
        第一行  #. module: base   格式為 #. module: 模塊的目錄名
        第二行  #: report:ir.module.reference:0
                格式為 #: report:報表文件的命名空間 這里取     name="ir.module.reference"
                里面的的值
               
        第三行  msgid "Menu :"  把模板對應要翻譯的字符復制過來
       

       
       
   
=================================報表類結束=================================   

 

=================================視圖界面類開始===============================
    @ 視圖中文字翻譯   
        #. module: stock
        #: view:stock.location.route:stock.stock_location_route_form_view
        msgid "Applicable On"
        msgstr "適用於"
        ------
        stock_view.xml
       
        <record id="stock_location_route_form_view" model="ir.ui.view">
            <field name="name">stock.location.route.form</field>
            <field name="model">stock.location.route</field>
            ...
            <separator string="Applicable On"/>
            ...
       
        第一行  #. module: stock  格式為 #. module: 模塊的目錄名
        第二行  #: view:stock.location.route:stock.stock_location_route_form_view
                格式為 #: view:模型名:模塊的目錄名.視圖的id名
        第三行  msgid "Applicable On" 把視圖對應要翻譯的那段復制過來
        這里是放在 string="str"        
        有<p>str</p>
        注:同一個模型的視圖要翻譯的字符串多次只有第一次的有效,后面再翻譯會忽略,
            若是同一個模型在多個視圖中要分別翻譯,只能在不同的視圖把要翻譯的字符串
            區分開來。
       
        這里適應較多情況:
        @ 搜索翻譯
            #. module: stock
            #: view:stock.picking:stock.view_picking_internal_search
            msgid "Draft"
            msgstr "草稿"
        @ 搜索幫助翻譯
            #. module: stock
            #: view:stock.picking:stock.view_picking_internal_search
            msgid "Draft Moves"
            msgstr "遷移草稿"
            ----
            stock_view.xml
            <record id="view_picking_internal_search" model="ir.ui.view">
            <field name="name">stock.picking.internal.search</field>
            <field name="model">stock.picking</field>
            <field name="arch" type="xml">
                <search string="Picking Lists">
                    <field name="name" string="Picking List" filter_domain="['|',('name','ilike', self),('origin','ilike',self)]"/>
                    <filter icon="terp-check" name="draft" string="Draft" domain="[('state','=','draft')]" help="Draft Moves"/>
            ....
           ------   
        @ 界面按鈕翻譯
            #. module: stock
            #: view:stock.move:stock.view_move_tree
            msgid "Process"
            msgstr "處理"
            -------
            stock_view.xml
           
            <record id="view_move_tree" model="ir.ui.view">
                <field name="name">stock.move.tree</field>
                <field name="model">stock.move</field>
                ...
                <button name="action_done" states="confirmed,assigned" string="Process" type="object"
                                groups="stock.group_stock_user" icon="gtk-go-forward" help="Done"/>
            -------
        @ 界面占位符翻譯
            #. module: product
            #: view:product.template:product.product.product_template_form_view
            msgid "Tags..."
            msgstr "產品標簽.."       
            ----------
            <record id="product_template_form_inherit" model="ir.ui.view">
                <field name="name">product.template.view.form</field>
                <field name="model">product.template</field>
                <field name="inherit_id" ref="product.product_template_form_view"/>
                <field name="arch" type="xml">
                    <xpath expr="//h1" position="after">
                        <field name="tag_ids" widget="many2many_tags" placeholder="Tags..."/>
                    </xpath>
                </field>
            </record>
            ----------
        @ 組標題提示翻譯
       
            #. module: stock
            #: view:stock.location:stock.view_location_form
            msgid "Additional Information"
            msgstr "其它信息"
            ----------
            stock_view.xml
           
            <group string="Additional Information">
                <field name="usage"/>
                <field name="partner_id"/>
                <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                <field name="scrap_location"/>
                <field name="active"/>
            </group>
            --------
=================================視圖界面類結束===============================   


=================================模型記錄類開始===============================
        @ 模型名描述
           #. module: payment_notice
           #: model:ir.model,name:payment_notice.model_payment_notice
           msgid "Receiving payment notice"
           msgstr "到款通知"
           --------
           class PaymentNotice(models.Model):
              _name = "payment.notice"
              _inherit = ['mail.thread']
              _description = "Receiving payment notice"
           -------
        第一行  #. module: payment_notice   格式為 #. module: 模塊的目錄名
        第二行  #: model:ir.model,name:payment_notice.model_payment_notice
                格式為 #: ir.model,name:模塊的目錄名.model_模型名
               
        第三行  msgid "Receiving payment notice"  對應到_description 后面的值


    @ 記錄名稱翻譯
            一般一條記錄會翻譯name字段,也可以是其它字段
        #. module: stock
        #: model:ir.model,name:stock.model_stock_inventory_line
        msgid "Inventory Line"
        msgstr "盤點表明細"
        --------
        stock.py
       
        class stock_inventory_line(osv.osv):
            _name = "stock.inventory.line"
            _description = "Inventory Line"
               
        --------
       
        ---------
        ir_model 表
        對應的數據表記錄:
        id    model                  name            state  info   create_uid  create_date write_uid  write_date
        308   stock.inventory.line   Inventory Line  base
       
        對應外記錄表 ir_model_data
        id    ....           name          .....
        7885           model_stock_inventory_line
       
        --------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: model:ir.model,name:stock.model_stock_inventory_line
                格式為 #: model:記錄的模型名,name:模塊的目錄名.記錄外部標識符
                若翻譯總無效 則改為 格式為 #: model:記錄的模型名,name:記錄外部標識符
                不要模塊的目錄名,
                這時 name 可以換成其它的 字段 像info 但要是這記錄有的字段
               
        第三行  msgid "Inventory Line"  記錄對應 name 字段的值
       
        --------
                這里記錄的name翻譯,記得這個字段要可以翻譯 如:'name': fields.char('Payment Term', translate=True, required=True)
                translate=True, 若沒有這個,你添加翻譯也不會顯示出來
        注:js 異步調用時要帶上 {context:self.session.user_context} ,否則記錄的name對就不會翻譯了
        如:instance.web.Model('res.users').call('get_challenge_suggestions', [],{context:self.session.user_context})
        對應在py里面一般帶上了context 里面有語言值
        這個是模型記錄翻譯的通用模板,下面那些只是這個模板的特例
               
    @ 動作窗體xml幫助翻譯
      針對窗體表的記錄對應字段的值翻譯
     
      動作窗體定義 /openerp/addons/base/ir/ir_action.py:
     
     class ir_actions_act_window(osv.osv):
        _name = 'ir.actions.act_window'
        _table = 'ir_act_window'
        ...
      -------------    
        
        #. module: stock
        #: model:ir.actions.act_window,help:stock.action_warehouse_form
        msgid ""
        "<p class=\"oe_view_nocontent_create\">\n"
        "                Click to define a new warehouse.\n"
        "              </p>\n"
        "            "
        msgstr ""
        "<p class=\"oe_view_nocontent_create\">\n"
        "                單擊定義新倉庫\n"
        "              </p>\n"
        "            "
        ----------
        stock_view.xml
       
        <record id="action_warehouse_form" model="ir.actions.act_window">
            <field name="name">Warehouses</field>
            <field name="res_model">stock.warehouse</field>
            <field name="type">ir.actions.act_window</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_warehouse_tree"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to define a new warehouse.
              </p>
            </field>
        </record>
       
        ----------
            第一行  #. module: stock  格式為 #. module: 模塊的目錄名
            第二行  #: model:ir.actions.act_window,help:stock.action_warehouse_form
                    格式為 #: model:ir.actions.act_window,help:模塊的目錄名.id名
                    ir.actions.act_window 是動作窗體的模型名
                    help是動作窗體記錄字段
                    這是針對 help字段的值 ,像上面也有 name 字段值 為 Warehouses
                    這時換成name 就可以了,還有很多,具體看動作窗體定義了哪些字段
                   
            第三行 把 name="help" 容器中的內容拷貝出來翻譯       
   
       
    @ 菜單翻譯
        #. module: stock
        #: model:ir.ui.menu,name:stock.menu_stock_inventory_control
        msgid "Inventory Control"
        msgstr "盤點管理"
        -------
        stock_view.xml
       
        <menuitem id="menu_stock_inventory_control" name="Inventory Control" parent="menu_stock_root" sequence="2"/>
       
        -------
        第一行  #.module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: model:ir.ui.menu,name:stock.menu_stock_inventory_control
                格式為 #: model:ir.ui.menu,name:模塊的目錄名.id名
                若有時翻譯不進來(一般是目錄名過長引起),就把 模塊的目錄名 去了變為  #: model:ir.ui.menu,name:id名
          第三行  msgid "Inventory Control"  顯示名稱

       
    @ 客戶動作事件翻譯   
   
      客戶動作事件模型定義
        class ir_actions_act_client(osv.osv):
        _name = 'ir.actions.client'
        _inherit = 'ir.actions.actions'
        _table = 'ir_act_client'
   
   
        #. module: stock
        #: model:ir.actions.client,name:stock.action_client_warehouse_menu
        msgid "Open Warehouse Menu"
        msgstr "打開倉庫菜單"
        -------
        res_config_view.xml
       
        <record id="action_client_warehouse_menu" model="ir.actions.client">
            <field name="name">Open Warehouse Menu</field>
            <field name="tag">reload</field>
            <field name="params" eval="{'menu_id': ref('menu_stock_root')}"/>
        </record>
        -------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: model:ir.actions.client,name:stock.action_client_warehouse_menu
                格式為 #: model:ir.actions.client,name:模塊的目錄名.客戶事件id名
        第三行  msgid "Open Warehouse Menu"  顯示名稱 視圖有對應的拷貝過來就可   

    @ 權限組翻譯
      用戶組模型定義:
      class res_groups(osv.osv):
        _name = "res.groups"
        _description = "Access Groups"
        _rec_name = 'full_name'
       
       
        #. module: stock
        #: model:res.groups,name:stock.group_tracking_owner
        msgid "Manage Different Stock Owners"
        msgstr "管理不同庫存擁有者"
        --------
        security/stock_security.xml
       
        <record id="group_tracking_owner" model="res.groups">
            <field name="name">Manage Different Stock Owners</field>
            <field name="category_id" ref="base.module_category_hidden"/>
        </record>
        --------
        第一行  #. module: stock   格式為 #. module: 模塊的目錄名
        第二行  #: model:res.groups,name:stock.group_tracking_owner
                格式為 #: model:res.groups,name:模塊的目錄名.分組id名
                若security.xml文件中 id 為 group_tracking_owener 則為模塊的目錄名.分組id名
                                        為 base.group_tracking_owener  則為 分組id名                   
        第三行  msgid "Manage Different Stock Owners"  權限組顯示名稱   

    @ 模塊說明翻譯
        在本地安裝模塊時就會顯示中文了
        #. module: base
                #: model:ir.module.module,description:base.module_stock_specific_inventory   
        msgid ""
        "\n"
        "Stock Specific Inventory\n"
        "==========================\n"
        "This module adds the possibility to make inventories on a product selection.\n"

        msgstr ""
        "\n"
        "最體產品估值\n"
        "==========================\n"
        "這個模塊增加可以指定具體的產品進行估值\n"
        "\n"
       
        --------
        __openerp__.py
       
            'description': """
            Stock Specific Inventory
            ==========================
            This module adds the possibility to make inventories on a product selection.
            """,
           
        --------
        翻譯要添加到 /openerp/addons/base/i18n/zh_CN.po 中 不能加在自己模塊的翻譯文件中
        第一行  #. module: base   格式為 #. module: base 這個是定死的
        第二行  #: model:ir.module.module,description:base.module_stock_specific_inventory   
                格式為 #: model:ir.module.module,description:base.module_模塊的目錄名   
                這里有對應關鍵字段 description 配置文件里還有name ,shortdesc, summary, category, 等
                對應改一下
        第三行  msgid ""  'description'里面的描述
        第四行  msgstr ""       
=================================模型記錄類結束===============================
       
翻譯表很容易出問題,特別在添加翻譯時,會導致系統啟動不來,
日志報錯如下:
InternalError: current transaction is aborted, commands ignored until end of transaction block

這時,就要針對 ir_translate 這個表,重建索引就可以。       

   


注:總是翻譯無效時,可以搜索旁邊的 翻譯,從而參照 寫翻譯條
    關鍵的標點符號要全英文,不能中文的
    注意我們中文的翻譯文件名是 zh_CN.po 不要寫錯了     

   # create_uid  Created by   創建人
   # create_date  Created on   創建時間
   # write_uid   Last Updated by  最后更新人  
   # write_date  Last Updated on  最后更新時間   
  
消息主菜碟里的英文,像 Whole Compnay Company News 等要通過更改菜單項來解決

財務相關翻譯
  # journal entry  會計憑證
  # journal items  會計分錄
  # Account Move  會計憑證
  # Reconciled  核銷
  # Group By 分組
  # Validate 審核
  # Approve 審批
  # Confirm 確認


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM