How to translate an OpenERP module?

前端 未结 3 519
名媛妹妹
名媛妹妹 2021-02-05 13:53

I\'ve just built a custom OpenERP module, let\'s say /addons/the_meaning_of_life. Now I want to translate it to another language. I now I\'m supposed to have an i18

3条回答
  •  盖世英雄少女心
    2021-02-05 14:48

    Here is a bash script that I use for this:

    $ cat oerp-i18n-module
    #!/bin/bash
    #
    # usage:
    # ./oerp-i18n-module  
    #
    # the script will create or update PO files for en, fr, de and es. You
    # will need to update the translations (and don't forget bzr add +
    # commit)
    
    dirname=$(find src -name $1 | egrep -v '(src/stable)|(src/server)')
    install -d ${dirname}/i18n
    for lang in en fr de es
    do
        python src/server/openerp-server -c config/instance_debug.ini \
                  --log-level=error --i18n-export=${lang}.po -l ${lang} \
                  -d $1 --modules=$2 > /dev/null 2>&1 
        if [ -f ${dirname}/i18n/${lang}.po ]
        then
            echo merge new translations in ${dirname}/i18n/${lang}.po
            msgmerge -vU --backup=simple ${dirname}/i18n/${lang}.po ${lang}.po
            rm ${lang}.po
        else
            echo put file in ${dirname}/i18n/${lang}.po
            mv ${lang}.po ${dirname}/i18n/
        fi
    done
    

    Hope this helps (you may have to edit some paths which are specific to my layout of bzr branches).

提交回复
热议问题