How to translate an OpenERP module?

前端 未结 3 518
名媛妹妹
名媛妹妹 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:39

    Install your desire lang in your db.

    Once you are done with your module development, install module on test server then go to the follwing Wizard Setting(or Configuration) > Translation> Import/Export/Export Translation. Then Choose the module the_meaning_of_life and desire lang. and export it in .po format.

    Save that po file then add the translation that you want in the po file. Then you can import back that po file in database or add it under your module under folder /addons/the_meaning_of_life/i18n and it is available with your module.

    (only for new modules), you need to have also the "pot" file in the same i18n folder, if you don't yet have it you can generate one by repeating step 2 but without choosing any language. This how you can make available translation for the some lang in your module but if you want use Launchpad translation service then check following url this will guide you using .pot but for that you need project on lp clearly.

    0 讨论(0)
  • 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 <databasename> <module name>
    #
    # 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).

    0 讨论(0)
  • 2021-02-05 14:49

    Ok here what you can do is:

    1. Install your desire lang in your db.
    2. Once you are done with your module development, install module on test server then go to the follwing Wizard Setting(or Configuration) > Translation> Import/Export/Export Translation. Then Choose the module the_meaning_of_life and desire lang. and export it in .po format.
    3. Save that po file then add the translation that you want in the po file. Then you can import back that po file in database or add it under your module under folder /addons/the_meaning_of_life/i18n and it is available with your module.
    4. (only for new modules), you need to have also the "pot" file in the same i18n folder, if you don't yet have it you can generate one by repeating step 2 but without choosing any language. This how you can make available translation for the some lang in your module but if you want use Launchpad translation service then check following url this will guide you using .pot but for that you need project on lp clearly.

    Hope this will answer you, Regards

    0 讨论(0)
提交回复
热议问题