ngx-translate-extract icon indicating copy to clipboard operation
ngx-translate-extract copied to clipboard

Add newline to the end of the translation files

Open smnbbrv opened this issue 3 years ago • 6 comments

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

smnbbrv avatar Jan 07 '21 14:01 smnbbrv

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

ghost683 avatar Mar 29 '21 12:03 ghost683

@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

smnbbrv avatar Mar 29 '21 12:03 smnbbrv

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

ghost683 avatar Mar 29 '21 12:03 ghost683

@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

smnbbrv avatar Mar 29 '21 12:03 smnbbrv

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

ghost683 avatar Mar 29 '21 12:03 ghost683

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

johncardiologs avatar Dec 15 '22 13:12 johncardiologs