Skip to content

Unable to handle translation strings containing escape sequences #78

@chrono-meter

Description

@chrono-meter

As the title says. When a translation string contains an escape sequence such as \n, tree-sitter does not provide a string representation, so the msgid will be expressed differently from the value expected by PHP or JavaScript.
I don't know if including escape sequences in translation strings is a widely used technique, but it's important to be aware that the output result may differ from what the library user expects.

Strings containing escape sequences become encapsed_string nodes, which contain string_content and escape_sequence nodes. It seems that only the raw value can be obtained from the escape_sequence node in question.
And it seems that we will probably not be able to obtain the correct value unless we implement PHP and JavaScript escape sequence processing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions