question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove capitalize() calls to avoid issues with other languages

See original GitHub issue

Is your proposal related to a problem?

There are (only) 4 calls of capitalize() in wagtail’s codebase and 3 of them actually lead to a bad wording in german, for example.

1) get_content_type_label(): https://github.com/wagtail/wagtail/blob/bf3a054c04eb66a923bac538caa64165fef79131/wagtail/coreutils.py#L153-L163 I think the second call (fallback if no model exists) can be kept, but the first one, which uses verbose_name, should be removed.

This is used in the audit logs for example: wagtail_capitalize_calls_german “Live-Update” (stored in verbose_name) is transformed to “Live-update”, which looks like a mistake in german.

2) Site settings: https://github.com/wagtail/wagtail/blob/bf3a054c04eb66a923bac538caa64165fef79131/wagtail/contrib/settings/models.py#L146-L147 https://github.com/wagtail/wagtail/blob/bf3a054c04eb66a923bac538caa64165fef79131/wagtail/contrib/settings/models.py#L201-L202

This results in the following: wagtail_site_settings_capitalize This example also shows some other translation issues, which I’ve fixed in #9217 (and in transifex).

Describe the solution you’d like

Can we remove the capitalize() calls where verbose_name is used, so it it can be properly translated?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
lb-commented, Sep 18, 2022

@th3hamm0r - as per your question - let’s go with the adoption of the capfirst in your PR - makes sense, if in the template - great, if not that is fine also.

After more digging, I can see that we use capfirst in the Python code a lot also, even throughout the settings app, for essentially the same purpose.

1reaction
gasmancommented, Sep 16, 2022

I never realised that capitalize lower-cases capital letters (other than the initial one) that were capitalised in the input! That seems counter-productive in any language.

Looks like Django’s django.utils.text.capfirst does what we want: https://github.com/django/django/blob/9c42933711667034c9335f408e1a8a53031e9865/django/utils/text.py#L14-L21

Read more comments on GitHub >

github_iconTop Results From Across the Web

Website localization, Title Capitalization and avoiding duplicates
I might not have the perfect solution for your problem, but here are some thoughts I think are worth sharing:.
Read more >
Is there an antonym for “capitalize” (as in letter-case)?
While I'll caveat that some people aren't fond of it being used as a verb, lowercase is frequently used in the manner you're...
Read more >
Ten Reasons Why I Don't Like Golang
The purpose presumably is to cut down on the public and private keywords, but capitalization was already used to mean other things: Classes ......
Read more >
Capitalize month names (#95) · Issues · GNOME / gnome-calendar ...
Some languages always capitalize month names, like English, and they provide month names capitalized in glibc locale database. · Some want to capitalize...
Read more >
Is Python Case-Sensitive? - LearnPython.com
Yes, Python Is a Case-Sensitive Language ... First, let's clarify what case sensitivity is. It's the differentiation between lower- and uppercase ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found