Giter VIP home page Giter VIP logo

gulp-angular-gettext's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gulp-angular-gettext's Issues

Support Comment annotations for string extraction

It would be nice to be able to detect strings to translate base on a special comment placed before instead of requiring to wrap into a gettext() function call.

e.g.

const myTranslatagleString = /* @ngTranslate */ "My String"
return gettextCatalog.getString(myTranslatagleString)

.pot file is overwritten everytime gettext.extract() is executed

Hi,

I cannot find the way to maintain the old translations and not overwrite them everytime.

this is my code

gulp.task('translations:parse', function () {
return gulp.src([conf.paths.src + '/app/**/*.html', conf.paths.src + '/app/**/*.js'])
    .pipe(gettext.extract('translations.pot', {}))
    .pipe(gulp.dest(conf.paths.src + '/app/translations/'));
});

So the first time the file "translations.pot" is generated. If I translate directly in this file, and I run gulp translations:parse again, the translations saved in "translations.pot" will be lost.

So let's say I have in translations.pot

#: partials/home.html:3
msgid "Welcome"
msgstr "Bienvenido"

After running gulp translations:parse again, the translations are lost

#: partials/home.html:3
msgid "Welcome"
msgstr ""

Is there any possible solution for that? How can I save the old translations?

Thanks a lot
Adrián Bolonio

Very strange bug with multiple attributes

Hey I have come across a very strange bug when using multiple attributes. I have a switch directive, within this I have a on attribute and a off attribute (what text to display when the switch is on and off).

If I have the attributes next to each other

<switch class="small"
checked="focused.settings.require
off="'global.no' | translate"
on="'global.yes' | translate"
>

gulp-angular-gettext does not see the second attribute

: journal/single.html:57

msgid "global.no"
msgstr ""

but if I have a attribute in between the two it does

<switch class="small"
off="'global.no' | translate"
checked="focused.settings.require
on="'global.yes' | translate"
>

: journal/single.html:57

msgid "global.no"
msgstr ""

: journal/single.html:57

msgid "global.yes"
msgstr ""

Is there a problem with multiple translated attributes in one element?

Relative references by default

Currently, the file references for a POT entry are absolute, e.g. /home/gabe/foo/src/partial.html. But that causes a lot of churn when the POT is checked into version control, since everyone's paths are different.

In all my client code, including the tests cases, I manually make the file references relative to the directory the POT file is written to. That won't work in gulp because the plugin doesn't know where you will output the POT file (that's handled later in the pipeline by gulp.dest). But we could make it relative to file.base or file.cwd which is almost always the root of the project.

Danish - "No language header found!"

I have following header set yet it's not recognised by angular-gettext.
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: POEditor.com\n"
"Project-Id-Version: app\n"
"Language: da\n"

The language is Danish.
I'm using gulp-angular-gettext to compile and extract. It might be a gulp-angular-gettext problem, but i'm not sure.

Issue when execute `pot` task

I catch the error when I launch gulp pot

node_modules/gulp-angular-gettext/node_modules/angular-gettext-tools/node_modules/esprima/esprima.js:3793
            throw e;
                  ^
Error: Line 18: Unexpected token >

Any idea, my code is similar to exemple given.

Make json the default format

Maybe it would be better to have {format: 'json'} as the default options object for compile function.

As you have said @gabegorelick in #13, it's really more efficient and natural in gulp environment to use this format as default instead of javascript.

single output file?

Hi,

Your example produces 1 js / po.
How could I output a single "translations.js" file like with grunt-ng-gettext? I know I could use gulp-concat, but this results in having one angular.module() loading for each file, which is not optimized...

Thanks

How to compile several .po files into one .js file?

In this example, you can compile all translations into one JavaScript file that looks like this:

angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) {
/* jshint -W100 */
    gettextCatalog.setStrings('uk', {/* strings */});
/* jshint +W100 */
}]);

How to compile the same file using gulp-angular-gettext ?

Compile [out] option

I'm migrating from angular-gettext from grunt to gulp. I can't find a way using this gulp plugin to compile to a single file for every languages *.po files.

Here's my grunt configuration that creates a single file app/scripts/translations.js

nggettext_compile: {
  all: {
      options: {
          module: 'ttpApp'
      },
      files: {
          'app/scripts/translations.js': ['po/*.po']
      }
  }
},

Maybe an [out] option could be implemented, like for extract task ?

SyntaxError: Use of const in strict mode.

Hi,
I've tried to install gul-angular-gettext to my project. But when i wrote
var gettext = require('gulp-angular-gettext');
in my gulpfile.js, i've got this error.
I use nodejs 4.4.5...

How to set PO File Headers?

maybe i'm blind, but how can i set default header, e.g. Project-Id-Version or Langauge to the created po file?

Preserve existing translated keys

Hello,

I may have missed something but how do you handle iterative worflow ?
Is there a way to generate POT files while keeping already existing keys from a given PO file ?
Each time I generate a pot file, I have a blank file so I need to manually merge my existing po file with that new one which is painfull :(

gulp don't create pot file

I have may be missed something, but I have just copy/paste the example.

gulp.task('pot', function () {
  return gulp.src(['static/admin/partials/*.html'])
    .pipe(gettext.extract())
    .pipe(gulp.dest('po'));
});

gulp.task('translations', function () {
  return gulp.src('po/**/*.po')
    .pipe(gettext.compile({
        format: 'json'
    }))
    .pipe(gulp.dest('static/admin/translations'));
});

gulp pot -> create one pot file per sources. It should create one pot file:

$ ls po/
edit.html       messages.html       nmd_immo.html       share.html
maps.html       nmd_dne.html        nmd_projets.html

Is this a bug ?

$ more po/edit.html
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: /Users/toutpt/makina/nmd/carteeco/mockup/static/admin/partials/edit.html
msgid "ACTIONS"
msgstr ""

...

gulp-angular-gettext does not create any content in target .pot file

Hi,
using the example config I have not been able to create any content in the target .pot file. The .pot file is more or less empty:

msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Project-Id-Version: \n"

the test input in JADE looks like this:

h2(translate) hometranslation
p {{home.ctrlName}}
translate Test
input(type='text', placeholder="{{'Username' | translate}}")

any idea on this?

thanks

ng-repeat problem

Hello,

I've something like this :

<option ng-selected="filter.selectedType === type.id" ng-repeat="type in filter.types" value="{{type.id}}">
{{type.name}}
</option>

How can I translate all items with you gulp task ?

I've try some like :

<option ng-selected="filter.selectedType === type.id" ng-repeat="type in filter.types" value="{{type.id}}" translate>
{{type.name}}
</option>

This format like this way :

+#: filter.html:53
+msgid "{{type.name | translate}}"
+msgstr ""
+

Thanks

Update dependencies

Hi!

When installing gulp-angular-gettext one gets deprecated warnings.
npm WARN deprecated [email protected]: the module is now available as 'css-select'

It comes from angular-gettext-tools which in turn comes from cheerio.
So updating the dependencies should solve the problem.

Thank you!

Broken lodash.isstring dependency version

The security fix on PR #45 broke the lodash.isstring version. Latest version is 4.0.1, which doesn't constrain builds to lodash < 4.17.5 as far as I can tell. Would it make sense to depend on lodash instead of lodash.isstring given that angular-gettext-tools and eslint already depend on it?

Extract stream crashes when no files are in the input stream

If I pipe a vinyl stream that has no files into a gulp-angular-gettext extract stream, I get the following error:

C:\Users\mbrunetti\Documents\mtdirect-next\packages\mtdirect-ui\node_modules\gulp-angular-gettext\lib\extract.js:74
      cwd: firstFile.cwd,
                    ^
TypeError: Cannot read property 'cwd' of null
    at DestroyableTransform.flush [as _flush] (C:\Users\mbrunetti\Documents\mtdirect-next\packages\mtdirect-ui\node_modules\gulp-angular-gettext\lib\extract.js:74:21)
    .....

It seems like the flush function expects that firstFile has been set, although it may not have been.

Output: Grunt vs. Gulp

I noticed that the output of the gulp and grunts tasks differ.

This bit me while reading the tutorial on the angular-gettext website, as it states: Be sure to add this file (in this case src/js/translations.js) to your project.

Grunt outputs additional angular code.
Grunt outputs the translations as Array(2) (or two parameters).
Wheres Gulp outputs JSON.

Grunt

angular.module('gettext').run(['gettextCatalog', function (gettextCatalog) {
/* jshint -W100 */
    gettextCatalog.setStrings('nl', {"Active":"Actief","All":"Alle","Clear completed ({{completedCount}})":"Wis afgewerkte taken ({{completedCount}})","Completed":"Afgewerkt","Double-click to edit a todo":"Dubbelklik om een todo te bewerken","Mark all as complete":"Markeer als afgewerkt","What needs to be done?":"Wat moet gedaan worden?","{{$count}} item left":["{{$count}} item te gaan","{{$count}} items te gaan"]});
/* jshint +W100 */
}]);

Gulp

{"nl":{"Active":"Actief","All":"Alle","Clear completed ({{completedCount}})":"Wis afgewerkte taken ({{completedCount}})","Completed":"Afgewerkt","Double-click to edit a todo":"Dubbelklik om een todo te bewerken","Mark all as complete":"Markeer als afgewerkt","What needs to be done?":"Wat moet gedaan worden?","{{$count}} item left":["{{$count}} item te gaan","{{$count}} items te gaan"]}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.