Skip to content

Using id as msgctxt #83

@Sand1929

Description

@Sand1929

Right now, to translate the same message with two different meanings, we use the id as key. For example, if I want to translate "Normal" as both a text style and an indentation mode:

#. [homepage.text_style-0]
#. defaultMessage is:
#. Normal
#: build/messages/assets/js/scenes/Homepage/index.json
msgid "homepage.text_style-0"
msgstr "običan"

#. [homepage.indentation_mode-0]
#. defaultMessage is:
#. Normal
#: build/messages/assets/js/scenes/Homepage/index.json
msgid "homepage.indentation_mode-0"
msgstr "obično"

This works pretty well, but it means the msgid is something like "homepage.indentation_mode-0" instead of the message you wanted to translate ("Normal"). This is somewhat inconvenient, since many PO file editors now provide features like translation suggestions or basic error-checking on translations, but expect msgid to be the text you're trying to translate. So what I propose is that we add a way to specify msgctxt. For example, we could use id as msgctxt and defaultMessage as msgid:

#. [homepage.text_style-0]
#. defaultMessage is:
#. Normal
#: build/messages/assets/js/scenes/Homepage/index.json
msgctxt "homepage.text_style-0"
msgid "Normal"
msgstr "običan"

#. [homepage.indentation_mode-0]
#. defaultMessage is:
#. Normal
#: build/messages/assets/js/scenes/Homepage/index.json
msgctxt "homepage.indentation_mode-0"
msgid "Normal"
msgstr "obično"

This allows us to use defaultMessage as msgid but still translate different meanings by using id as context (msgctxt). It's also a little less confusing to translators (at least the ones I asked) since the text they are trying to translate shows up where they expect in their PO file editors.

Let me know what you think! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions