Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update built-in help output for localization (Issue #3907) #3911

Merged

Conversation

hugodahl
Copy link
Collaborator

Adding localization values for the output of calls to help() can match the current firmware's language.

This change addresses issue #3907

n.b.: This is a recreation of PR #3908 since ran into issues with my previous local branch. Apologies for the noise and mess.

Support localizing the output of a call to  to match the
firmware's language.
@hugodahl hugodahl marked this pull request as ready for review December 31, 2020 00:26
… add-translation-for-builtin-object-help

* 'main' of https://github.com/adafruit/circuitpython:
  update wake-alarm implementation
  enable light-sleep functionality
  update frozen libs for 6.1.0-beta.3
  Revert "Removing frozen libs"
  add pretend-to-sleep functionality
  expose wake pin parameter and more tweaks
  add touch alarm support for esp32s2
  implement touch alarm
tannewt
tannewt previously approved these changes Jan 5, 2021
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thank you! I'd love to find a way to do the full help text too. I ran into an issue that gettext can't find the multiline contents when I tried before.

@hugodahl
Copy link
Collaborator Author

hugodahl commented Jan 6, 2021

I'm certainly not an expert on GetText, but from what I've run into with other systems in the past, I suspect it might have to do with the default locale text being the key. So say the text is "This help text spans\nmultiple lines", it might be transforming that into something like "This help text spans\\nmultiple lines", some form of truncation or perhaps some other mutilation. Or it might just make a mess of itself and move on.

Ideally, the key text would be a simple string that the system doesn't have a chance (or need) to transform in any way. For example, using the message "division by zero". Within the code itself, in its place would be "DIVISION_BY_ZERO" or some other agreed-upon formatted text.

For a more complex example, using this string:

"

Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues"

Its key could be something like "GITHUB_ISSUE_WITH_CONTENTS". That would require a good amount of refactoring, including creating the English "Translation", and ensuring that the builds for the en locale apply the text as appropriate. The upside is, it gets to be immediately obvious if there's an untranslated string. Particularly if a translation rule can be created, something like [A-Za-z0-9][A-Za-z0-9_-]{4,} to ensure both style, format and other rules (minimum length, etc).

@tannewt
Copy link
Member

tannewt commented Jan 6, 2021

Its key could be something like "GITHUB_ISSUE_WITH_CONTENTS". That would require a good amount of refactoring, including creating the English "Translation", and ensuring that the builds for the en locale apply the text as appropriate. The upside is, it gets to be immediately obvious if there's an untranslated string. Particularly if a translation rule can be created, something like [A-Za-z0-9][A-Za-z0-9_-]{4,} to ensure both style, format and other rules (minimum length, etc).

This is fine with me if you want to switch it to this!

@hugodahl hugodahl force-pushed the add-translation-for-builtin-object-help branch from bf80442 to ad7f4d8 Compare January 8, 2021 23:56
@tannewt
Copy link
Member

tannewt commented Jan 12, 2021

Please update the .pot again. I've merged lots of things in. Thanks!

@hugodahl
Copy link
Collaborator Author

hugodahl commented Jan 12, 2021

Merge conflict resolved, although that was an odd conflict. Waiting for the checks to complete

Fix missing closing quote
… add-translation-for-builtin-object-help
… add-translation-for-builtin-object-help

* 'main' of https://github.com/adafruit/circuitpython:
  Revert "UMFEATHERS2 - implement use of DotStar for status led"
  fix doc build
  Update to 1.7.1
  Set year from execution date
  Hard code new copyright date
  Update translations
  ulab: update to 1.7.0
  Rename to match WIFI_REASON. Also include specific error code in "Unknown failure" Exception.
  Include all reason codes.
  Rename to match WIFI_REASON. Also return specific reason code.
  Retry on all disconnect reasons other than: 2 exception reasons & 1 manual disconnect reason.
@tannewt
Copy link
Member

tannewt commented Jan 20, 2021

@dhalbert should these boards build now?

@dhalbert
Copy link
Collaborator

Yes, I will re-run

@dhalbert
Copy link
Collaborator

I would like to hold off on this PR for 6.1.0-beta.0. A number of de_DE builds are overflowing by small amounts. It would be nice to find some savings somewhere rather than radically shrink these builds, or do special de_DE builds.

@dhalbert
Copy link
Collaborator

I would like to hold off on this PR for 6.1.0-beta.0. A number of de_DE builds are overflowing by small amounts. It would be nice to find some savings somewhere rather than radically shrink these builds, or do special de_DE builds.

This is not as complicated as I thought. I think I have the fixes I need.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

All set! Thanks!

@dhalbert dhalbert merged commit e3275be into adafruit:main Jan 22, 2021
@hugodahl hugodahl deleted the add-translation-for-builtin-object-help branch January 22, 2021 13:50
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.

No localized strings for built-in help of objects
3 participants