Skip to content

Position of comments breaks parsing of .strings files #17259

@myjupyter

Description

@myjupyter

Describe the issue

The problem:

Seems like Weblate depends on the position of comments in .strings files while parsing it

I tried to figure out what is going on and compared "correct" file from hosted.weblate.com and mine

In the already existing files on hosted.weblate.com .strings and its comments have next structure and they're parsed well by Weblate

// comment
"key"="value";

or

/* comment */
"key"="value";

In case of different comment position ( on the same line as key-value string )

"key"="value"; /* comment */

weblate doesn't parse it correctly and I get a mess on the translation page

The Documentation of .strings format doesn't inform where comment string must be, but it refers to c-style comment and they can be placed above and on the same line at the very least

The source page
Image

The translation page
Image

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Create .string file and its translation file in your repo like

source file

"key1"="source_value1"; /*description1*/
"key2"="source_value2"; /*description2*/

translation file

"key1"="target_value1"; /*description1*/
"key2"="target_value2"; /*description2*/
  1. Import repo to weblate
  2. You'll see the problem when you open translations of these strings

Expected behavior

Weblate parses translation .strings files well

Screenshots

No response

Exception traceback

How do you run Weblate?

Docker container

Weblate versions

5.14.3

Weblate deploy checks

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: File format supportIssues related to file formats implemented in Weblate.Blocked by upstreamThe solution to this issue depends on a third-party project and needs to be addressed there first.Waiting for: TriageAssigned automatically for any new issue, needs attention from a Weblate member.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions