Skip to content

Newline character (\n) is not preserved. #10

@AchoArnold

Description

@AchoArnold

When I have a translation template with a newline character, the newline character (\n) isn't preserved in the translated output. Instead I get an escaped newline character \\n

Repro Steps.

en.yml

en:
  temp1: |
    Hello
    World
  temp2: Hello \n\n World

main.go

ctx, err := ctxi18n.WithLocale(context.Background(), "en")
if err != nil {
    panic(err)
}

fmt.Print(i18n.T(ctx, "temp2"))

Actual

"Hello \\n\\n World"

Expected

"Hello \n\n World"

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