rubenv / angular-gettext-tools

Tools for extracting/compiling angular-gettext strings.
http://angular-gettext.rocketeer.be/
MIT License
39 stars 129 forks source link

Extraction from JS does not work. #139

Closed jasdhfjhq2412341234 closed 8 years ago

jasdhfjhq2412341234 commented 8 years ago

Hi! I use angular-gettext-tools with @gabegorelick 's gulp-angular-gettext. Everyhing is okay with html files, but I fail to extract strings from js file. I tried both gettextCatalog.getString and gettext functions - together and separately - nothing worked.

My code for extraction looks like this:

      $scope.openCreateOfferPopup = function($event, buttonState) {
        $event.preventDefault();
        loadTypes();
        logger('openCreateOfferPopup');
        if (buttonState) {
          var params;
          if (!$rootScope.dashboard.spots || $rootScope.dashboard.spots.length === 0) {
            params = {
              title: 'Spots needed',
              content: gettextCatalog.getString(gettext("Oops! You need to add your spot before creating an offer!"))+
              '<br/>'+gettextCatalog.getString(gettext("Please, click on Create new spot button")),
              buttons: [{
                text: gettextCatalog.getString(gettext("Create spot")),
                href: '',
                'class': '',
                ngClick: 'openCreateSpotPopup($event)',
                ngController: 'SpotsController'
              }, {
                text: gettextCatalog.getString(gettext("cancel")),
                href: '#',
                'class': 'b-close'
              }]
            };
            DialogService.makeDialog(params, $scope);
            return;
          }

My gulp task looks like this:

import gulp from 'gulp';
import gettext from 'gulp-angular-gettext';
//import debug  from 'gulp-debug';

gulp.task('pot', function () {
    return gulp.src(['src/app/**/*.html','src/app/**/*.js',
            '!src/app/pages/static/acceptable_policy.html','!src/app/pages/static/legal.html',
            '!src/app/pages/static/privacy_policy.html','!src/app/pages/static/refund_policy.html',
            '!src/app/pages/static/terms_of_service.html'])
        //.pipe(debug({title: 'files to translate:'}))
        .pipe(gettext.extract('template.pot', {
            // options to pass to angular-gettext-tools...
        }))
        .pipe(gulp.dest('po/'));
});

I am pretty sure that js file is passed to aangular-gettext-tools - I used gulp-debug to verify it.

Could you point me to the source of this problem?

I have gulp-angular-gettext@2.1.0 using angular-gettext-tools@2.1.13 and gulp 4.0.0-alpha.2

jasdhfjhq2412341234 commented 8 years ago

Sorry, used a wrong user :(