Skip to content

Allow splitting of translatable strings #11071

@codeofdusk

Description

@codeofdusk

The translation system should allow strings to be split across lines. See #10941 (comment)

Summary of the problem

When a translation string is too long (generating a flake8 error) there is no way to reformat it to avoid the flake8 warning and such that the translation system picks up the string and translation comment correctly.

The following gives an error ET113 (flake8-tabs) option continuation-style=hanging does not allow use of alignment as indentation

label=(
	# Translators: blah
	_("Use currently saved settings on the logon and other secure screens"
	" (requires administrator privileges)")
)

Really the translation system should handle one of the following:

# Translators: blah
label=_(
		"Use currently saved settings on the logon and other secure screens"
		" (requires administrator privileges)"
	)
label=_( # Translators: blah
		"Use currently saved settings on the logon and other secure screens"
		" (requires administrator privileges)"
	)

Work around for now

For now just disable the "line too long" error. EG:

label=(
	# Translators: blah
	_("Use currently saved settings on the logon and other secure screens (requires administrator privileges)")  # noqa: E501 line too long

Other notes

Check the pot file in output directory. Ensure that translator comment and string are available.

Questions

Are split strings the pot file handled correctly? EG the following pot file entry:
Note that msgid starts with empty string, then two more strings on new lines:

#. Translators: The label for a button in general settings to copy current user settings to system
#. settings (to allow current settings to be used in secure screens such as
#. User Account Control (UAC) dialog).
#: gui\settingsDialogs.py:735
msgid ""
"Use currently saved settings on the logon and other secure screens (requires "
"administrator privileges)"
msgstr ""

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions