Skip to content

Internationalize styled strings #1285

Open
@PIG208

Description

@PIG208

For strings like '${mention(sender!, silent: true)} ${inlineLink('said', url)}: ' (the beginning of a quote-and-reply text), where part of it is styled with markdown syntax, or strings like

    return TextSpan(children: [
      TextSpan(text: "(unimplemented: text «", style: errorStyle),
      TextSpan(text: htmlNode.text, style: errorCodeStyle),
      TextSpan(text: "»)", style: errorStyle),
    ]);

where the string is fragmented with TextStyle's, expressing them with the regular placeholders is challenging.

For the quote-and-reply string, we could define a string "{user} [said]({link}): ", but that requires the translators to write valid Markdown. We want something like {user} <z>said</z>:, where only said is translatable. In zulip-mobile, we have:

          text={{
            text: 'Suggestion: <z-link>{suggestedServerUrl}</z-link>',
            values: {
              suggestedServerUrl: suggestion,
              'z-link': chunks => (
                <ZulipText
                  inheritFontSize
                  style={styles.suggestionTextLink}
                  onPress={() => handlePressSuggestion(suggestion)}
                >
                  {chunks}
                </ZulipText>
              ),
            },
          }}

(See #1148 (comment))

To resolve this, we need to search for a similar API.

For quote-and-reply specifically, we want to translate the string using the realm's locale setting, not the user's.

This is a follow-up to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-i18nTranslation, localization, internationalization

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions