vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.71k stars 274 forks source link

Convert "\n" to "\\n" in xliff files #723

Closed eshagh79 closed 2 years ago

eshagh79 commented 2 years ago

Hi. When translating an xliff file, all the words "\n" are displayed with "\n". "\n" must also be used for translation to be properly stored in the source file. If we enter "\n" by mistake, only a new line will appear in the source file and the word "\n" will not be entered

نماگرفت از 2021-11-03 09-25-47 .

vslavik commented 2 years ago

\n is a visual indicator of a newline.

If you believe something else is going on, please provide full reproduction instructions, as you were instructed when you created this issue, including attaching the file in question and step by step instructions on how to reproduce it.

eshagh79 commented 2 years ago

I know what "\n" is. butThat is, two slash before the character n Because when we open a .po file in a poedit and type "\n", it stores exactly the same string "\n" in the .po translation file. But when we open an .xliff translation file with poedit and write "\n", it unexpectedly creates a new line in the translation file and does not write the string "\n" in file.

Reproduction steps:

  1. Download and extract the attached file.
  2. Open the .xliff file in the extracted folder with the poedit program
  3. Type "\n" in the first string translation field (not "\n")
  4. Save the translation file
  5. Open the .xliff file again with a text editor such as vim or gedit
  6. You will see that the string "\n" is not written, and only one new line has been created.

Note: The attached file is an example to make the problem easier to see test.zip .

eshagh79 commented 2 years ago

I found this to be because the .xliff file can handle the new line and does not need "\n". And I thought it must be like the po case that I was wrong. Thank you for your time.