콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

I have this question opened here:

http://stackoverflow.com/questions/43892397/odoo-how-to-translate-strings-in-javascript-file


Copy/paste:

I'm struggling with the lack of understanding on doing Javascript. The Odoo documentation is painfully poor and I have another question on this topic without an answer here: http://stackoverflow.com/questions/42227474/odoo10-how-to-do-javascript

I hope I'll have more luck with this one.

What I'm trying to do now:

    var _t = null;
    odoo.define('mymodule.translate', function (require) {
    "use strict";
        var translation = require('web.translation');
        _t = translation._t;
        console.log("_t assigned");
    });

A view:

    app.categoriesView = Backbone.View.extend({
        tagName: 'div',
        className: 'categoriesView',
        template: _.template($('#categories_list_template').html()),
        initialize: function() {
            this.title = _t('OUR PRODUCTS');
            console.log("Initilized title: "+this.title);
        },
    });

Po file:

    #. module: mymodule
    #: code:addons/mymodule/static/js/views.js:8
    #, python-format
    msgid "OUR PRODUCTS"
    msgstr "PRODUKTI"

I don't get any errors and firebug console only says:

    _t assigned
    Initilized title: OUR PRODUCTS

So the string doesn't get translated. What am I doing wrong?




아바타
취소
관련 게시물 답글 화면 활동
1
7월 18
10235
0
4월 16
25694
2
6월 23
42566
1
9월 21
8689
0
2월 21
1880