biesbjerg / ngx-translate-extract

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

spaces in translation causes problems when switching languages #212

Closed robstoll closed 3 years ago

robstoll commented 4 years ago

relates to #175 I guess. I have finally updated to 7.0.0 and tried out if it works as it should following the problem

<p translate>
  Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore 
  et dolore magna   aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
</p>

the problem are the leading and ending spaces. For whatever reason the translate does not work this way, in certain scenarios:

note that it does not happen if there is no space at the beginning and end of the tag, then every scenario above works as it should. I.e. if it is as follows:

<p translate>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore 
  et dolore magna   aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.</p>
biesbjerg commented 3 years ago

This sounds more like a problem with ngx-translate to me?

robstoll commented 3 years ago

You're right, the extraction is exactly the same for both shown cases. Going to open an issue at ngx-translate