Nggettext globalization + grunt automization + jade templates

233 views Asked by At

I found this super informative and useful article about globalization using angular's gettext directive and grunt. Problem is, it seems to extract from .html files only and I can't really get it running with jade.

I am using Node.js for my server, together with Express.js, so I convert my .jade files to .html files on the fly, on each user request. I really like the way express and jade fit together, so I am searching for a solution, which extracts translations from those jade files.

For now I tried changing the grunt task snippet to:

grunt.initConfig({

        nggettext_extract: {
            pot: {
                files: {
                    'po/template.pot': ['**/*.jade']
                }
            }
        }
});

And also adding the translation directive as I do for all other angular directives, e.g.:

h3(translate) About
1

There are 1 answers

0
Austin Thompson On BEST ANSWER

To add jade file support to angular-gettext you would need to modify extract.js in the angular-gettext-tools project because that is what is actually scanning and extracting the text. It doesn't look like a trivial change.

I would suggest a different approach. See if you can generate html for all the jade files as part of a build process and then run the angular-gettext tools against that. Then you continue to develop as you like but you do not to need to add jade support to angular-gettext.