Skip to content

Fix formatting and translation for other languages in rule_to_text#186

Open
Ibrohimbek wants to merge 1 commit into
jazzband:masterfrom
Ibrohimbek:fix_formatting_and_translation
Open

Fix formatting and translation for other languages in rule_to_text#186
Ibrohimbek wants to merge 1 commit into
jazzband:masterfrom
Ibrohimbek:fix_formatting_and_translation

Conversation

@Ibrohimbek

Copy link
Copy Markdown

Comment thread recurrence/base.py
'number': rule.interval,
'freq': timeintervals[rule.freq]
})
_(f'every {rule.interval} {timeintervals[rule.freq]}')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the order between "translation" and "interpolation".

For instance, if we look at the spanish translations: The old code first looks up the translation of 'every %(number)s %(freq)s', which is 'cada %(number)s %(freq)s', and then fills in the value of number and freq in the string.

The new code will first fill in the values, and then try to look up the string in the translation catalog. For instance, if number is 5 and freq is "years" (which will be translated to "años"), it will look in the translation catalog for "every 5 años", which will not exist.

These same remarks apply to all the other changes in this pull request.

While the change could be made from %-based formatting to .format()-based formatting, f-strings are not capable of dealing with the case of translations.

Also, I can not see what problem this pull request is trying to solve. Maybe that could be better described?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants