biesbjerg / ngx-translate-extract

Extract translatable (using ngx-translate) strings and save as a JSON or Gettext pot file
MIT License
524 stars 196 forks source link

Add newline to the end of the translation files #224

Open smnbbrv opened 3 years ago

smnbbrv commented 3 years ago

Hi @biesbjerg ,

I constantly hit a very simple-to-fix issue.

The .editorconfig forces IDE to add a new line in the end of the file, and the regenerate command removes this newline.

So, git thinks something is updated although nothing really is.

Could it be added by default / as a configuration parameter?

To be more precise. This is what is currently generated:

{
  "token": "value"
}

and this is desired output

{
  "token": "value"
}
<-- newline here
ghost683 commented 3 years ago

https://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file

smnbbrv commented 3 years ago

@ghost683 this is good for Linux-like OS, but is not applicable to e.g. Windows. I still believe this should be provided by the tool itself

ghost683 commented 3 years ago

i'm not sure, i'am not on project, but some time ago I had the same need and i solved it as well, otherwise you coul'd try "echo >> file.txt". https://stackoverflow.com/questions/23055831/add-new-line-character-at-the-end-of-file-in-bash

smnbbrv commented 3 years ago

@ghost683 you are right, there are tons of ways to deal with this. But this issue is not about workaround, it's about the feature that is missing in 99% of the projects

ghost683 commented 3 years ago

i know, it was just a suggestion, i solved it like this

johncardiologs commented 1 year ago

It seems this issue would be closed by https://github.com/biesbjerg/ngx-translate-extract/pull/204