2

i want to use angular-gettext to implement i18n on my app, i followed this http://lostechies.com/gabrielschenker/2014/02/11/angularjspart-12-multi-language-support/ i used this commands :

  npm install -g grunt-cli
  npm install grunt
  npm install grunt-angular-gettext

my Gruntfile.js :

 module.exports=function(grunt){
grunt.loadNpmTasks('grunt-angular-gettext');
//This task will parse all our source files and extract the texts we want to have translated – the ones that have an associated translate directive – and add them to a so called pot file.
grunt.initConfig({
    nggettext_extract:{ //we define the task name we want to configure or initialize
        pot:{
            files:{
                'po/template.pot':['../templates/*.html'] //we want the task to parse all html files in the current directory or any sub directory of it and output the result of the task into a file called template.pot
            }
        }
    },
    nggettext_compile:{
        all:{
            files:{
            'translations.js':['po/*.po'] //we want this task to load all po files in the subfolder po of the current directory and compile them into a resulting file translations.js located in the current directory.
            }
        }
        }
});

  }

when i use this command grunt nggettext_extract to extract tranlation i have this error :

  >> Local Npm module "grunt-angular-gettext" not found. Is it installed?
   Warning: Task "nggettext_extract" not found. Use --force to continue.

   Aborted due to warnings.

i don't know why? the package grunt-angular-gettext exists in node modules can you help me to deal with this?

hanane
  • 64
  • 1
  • 9

3 Answers3

5

Try to run in your project folder:

npm install grunt-angular-gettext --save-dev

I had a similar issue and running the above command did the trick for me

AndreiC
  • 1,490
  • 4
  • 16
  • 34
1

I don't know if this will help you or not, but I was getting the same error, and after some time looking into it, I realized that my nggettext_extract entry in grunt.initConfig was incorrect, I had it at the wrong level (I accidentally put it inside shell), I see that's not your problem, but it might still be something in the Gruntfile.

Carlos
  • 11
  • 1
1

The solution is to first make sure that you have a package.json file in the directory.

run: npm init then npm install grunt npm install grunt-angular-gettext

This will install the actual module. More on this topic can be found: https://github.com/gruntjs/grunt/issues/232

afabijan
  • 196
  • 1
  • 1
  • 9