lokalise / lokalise-cli-2-go

Lokalise CLI v2
Other
108 stars 52 forks source link

Output file line breaks (CRLF vs LF / \r\n vs \n / macOS vs Windows) #62

Closed mtrakal closed 2 years ago

mtrakal commented 3 years ago

gradle task:

        exec {
            commandLine(
                    "lokalise2",
                    "file",
                    "download",
                    "--token", lokaliseToken,
                    "--project-id", lokaliseProjectId,
                    "--format", "xml",
                    "--add-newline-eof=true",
                    "--dest", ".",
                    "--unzip-to", "app/src/main/res",
                    "--export-sort", "a_z",
                    "--export-empty-as", "base", // empty, base, skip
                    "--include-comments=false",
                    "--include-description=false",
                    "--indentation", "4sp",
                    "--replace-breaks=true"
            )
        }

when we run command on macOS, exported XML files have line endings: CRLF (\r\n), but on Windows it have LF (\n) it make changes in git when command is used by more devs.

beinarovic commented 3 years ago

Hey @mtrakal , I think it's because of the --replace-breaks=true option, it replaces them to \n. But if this doesn't help, feel free to reach out to us in the support chat on the website.

https://app.lokalise.com/api2docs/curl/#transition-download-files-post

mtrakal commented 3 years ago

As I understand --replace-breaks=true do this:

Lokalise string:

this is 
multiline
text

convert to:

this is\n
multiline\n
text

It has nothing to do with break line in files, just in downloaded texts.

andrewLab-lokalise commented 3 years ago

@mtrakal, I backlogged the issue. We will investigate for the solution further

andrewLab-lokalise commented 2 years ago

Hey, @mtrakal, It seems for me that for files generated by a tool to have OS-specific endings is correct behavior. Maybe, the correct way would be to configure git to handle the issue as described here:

andrewLab-lokalise commented 2 years ago

Will close the issue for now. If the problem still persists and the solution above is not viable, please contact our support on https://lokalise.com