rmraya / OpenXLIFF

An open source set of Java filters for creating, merging and validating XLIFF 1.2, 2.0 and 2.1 files.
https://www.maxprograms.com/products/openxliff.html
Eclipse Public License 1.0
65 stars 17 forks source link

Feature request: Hide leading whitespace #1

Closed foolo closed 5 years ago

foolo commented 5 years ago

Currently any whitespace before a sentence and between sentences is included in the translatable segment, but not the trailing whitespace (see example below). The suggestion is that all leading and trailing whitespace is hidden from translation. (It is of course easy to hide it the CAT tool, but it could be an improvement for the OpenXLIFF library anyway.)

With an example document like this, with spaces before, between, and after the sentences: " Sentence one. Sentence two. "

you get xliff like this:

<source xml:space="preserve">   Sentence one.</source>
...
<source xml:space="preserve"> Sentence two.</source>

(I.e. spaces are there, except after sentence two. Is suppose that the last whitespace is hidden in the skeleton?)

rmraya commented 5 years ago

Spaces are handled by the SRX file used when generating the XLIFF file. You can use a custom SRX file that sends spaces to the skeleton.

The default SRX file shows the spaces because they are important for translators. In some languages those spaces must be removed and in others they have to be doubled.

Customize the segmentation rules that you ship or let your users do it according to the languages they use.

In your example, the trailing space is not shown because it has been extracted to a new segment and that segment has nothing to translate.

foolo commented 5 years ago

That makes sense, thanks for the reply! I will look at the SRX rules.