Skip to:
Content
Pages
Categories
Search
Top
Bottom

Strings containing new lines like emails content are not translated

  • @calvin_42

    Participant

    Hi there!

    (note : backslashes are removed on the forum, so “n” is “backslash-n”)

    I have a problem concerning the translation using the po/mo files. Everything works fine except for the emails content because of the new lines. Not the \n new line, but real new lines in code, as for example the file bp-groups-notifications.php:21 :

    `
    $message = sprintf( __(
    ‘Group details for the group “%s” were updated:

    To view the group: %s


    ‘, ‘buddypress’ ), $group->name, $group_link );
    `

    Using Poedit myself or using the official translations (french in my case) generates the same po entry :

    `
    #: bp-groups/bp-groups-notifications.php:23
    #, php-format
    msgid “”
    “Group details for the group “%s” were updated:n”
    “n”
    “To view the group: %sn”
    “n”


    n”
    msgstr “”
    “Les options de la famille “%s” ont été mises à jour:n”
    “n”
    “Accéder à la famille: %sn”
    “n”


    n”
    `

    In run time, the match is not made and therefore the content is not translated. The only way will be to add_filters to modify the email content, replacing the real new lines by n.

    Any idea how to solve it ?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • @calvin_42

    Participant

    Up!

    Any idea ?

    @djpaul

    Keymaster

    It’s best to ask someone more used to the translations format; I’ve not heard about this issue before. What about trying the wp-polyglots mailing list?

    @anonymized-96400

    Inactive

    Yup, that’s a known problem. Rather than using actual line breaks in strings, using `n` and keeping everything on one line resolves this issue.
    Something like this will work:
    `Group details for the group “%s” were updated:nnTo view the group: %s`

    @calvin_42

    Participant

    Thanks for the feedback. I didn’t found an existing ticket, so I’ve created #2703 (https://trac.buddypress.org/ticket/2703).

    @aphrodite

    Participant

    waiting for that… :)

    an update of the pot file with poedit on 1.2.6 from source added 683 stings of text, but some not correct such as variable strings.

    And I confirm the issue that at least all notifications mails are not in the pot file by default.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Strings containing new lines like emails content are not translated’ is closed to new replies.
Skip to toolbar