Skip to content

i18n: Use complete source strings instead of fragments (Python) - #724

Closed
echoix wants to merge 11 commits into
mainfrom
i18n-complete-source-strings-python
Closed

echoix wants to merge 11 commits into
mainfrom
i18n-complete-source-strings-python

Conversation

@echoix

@echoix echoix commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Description

Some messages were built from separately translated fragments, or from a runtime string passed to gettext, so translators cannot adapt word order or punctuation. These were flagged by comments on Weblate. This PR replaces them with complete format strings in the Python tools and the wxGUI; the C code is in a separate PR.

  • r.reclass.area: complete messages, one per combination of thresholds.
  • r.in.wms, v.what.strds, v.rast.stats, r.in.srtm, m.proj: error and status messages are single strings (no trailing-space fragments).
  • Temporal framework (core.py, temporal_algebra.py): the mapset error and the wrong-input error were built before being passed to gettext, so they were never translated.
  • wxGUI: render status bar, scatterplot title and axis labels, database table tab labels, GCP overwrite question, toolbar "Set map canvas for ... / Zoom to map" tooltips, parameter-dialog status text, mapset/type selector labels, model condition, layer group, psmap labels and distance measuring log are complete strings.
  • wxGUI RLi sample area title was _("Select sample area 1 of " + str(n)); it now uses the same msgid as the update just above it.
  • wxGUI tplot: the CSV error message ended in "or " with nothing after it. It now reads "Please change name of output CSV file or enable overwriting." Please check the wording matches the intent.
  • wxGUI preferences: removed the trailing space in "Random colors according to category number".

Motivation and context

Translators on Weblate reported that these messages cannot be translated correctly with a different word order.

How has this been tested?

ruff format and ruff check report no changes; the modified files compile.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to not work as before)

Checklist

  • PR title provides summary of the changes and starts with one of the
    pre-defined prefixes
  • My code follows the code style
    of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

AI assistance (Claude) was used to find the affected strings and to draft these changes.

@echoix

echoix commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

Rename title

Comment thread gui/wxpython/gui_core/forms.py Outdated
Comment thread gui/wxpython/gui_core/gselect.py Outdated
Comment thread scripts/r.in.wms/wms_drv.py Outdated
Comment thread scripts/v.rast.stats/v.rast.stats.py
Comment thread scripts/v.what.strds/v.what.strds.py
@echoix echoix changed the title Translation: Use complete source strings instead of fragments (Python) i18n: Use complete source strings instead of fragments (Python) Oct 4, 2026
echoix and others added 5 commits October 4, 2026 11:07
The verbose and fatal messages were assembled from fragments such as ' larger than or equal to %f hectares...', which translators cannot reorder. Use one complete string for each combination of thresholds.
The reason was appended to a translated string ending in 'Reason: '.
Cover the render status bar, scatterplot title and axis labels, RLi sample area title (previously a runtime string passed to gettext, so never translated), database table tab labels, GCP overwrite question, and two incomplete or trailing-space messages.
Replace messages assembled from translated fragments or passed to
gettext as already-built strings with complete format strings, in the
temporal framework, wxGUI toolbars, selectors and logs, and several
scripts. Also drop trailing spaces from a few messages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@echoix
echoix force-pushed the i18n-complete-source-strings-python branch from f25496f to 9705e3b Compare October 4, 2026 15:07

@echoix echoix left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Suggestions from a review of this branch: two more temporal messages that are never translated, an edge case in r.reclass.area where the new branches can print "None", and a placeholder-naming nit. The suggested code passes ruff format.


Generated by Claude Code

Comment thread python/grass/temporal/core.py
Comment thread scripts/r.reclass.area/r.reclass.area.py Outdated
Comment thread scripts/r.reclass.area/r.reclass.area.py Outdated
Comment thread scripts/r.reclass.area/r.reclass.area.py Outdated
Comment thread python/grass/temporal/core.py
Comment thread python/grass/temporal/core.py
Comment thread python/grass/temporal/core.py
Comment thread python/grass/temporal/core.py
…eConnection

Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>
Applying the review suggestions for the mogrify and transaction mapset
errors kept the old fatal() calls unclosed before the new ones, which
made core.py fail to compile.
@echoix
echoix force-pushed the i18n-complete-source-strings-python branch from be2276f to d265a24 Compare October 10, 2026 13:38

@echoix echoix left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Suggestion for the placeholder name.


Generated by Claude Code

Comment thread scripts/r.reclass.area/r.reclass.area.py Outdated
@echoix echoix closed this Oct 11, 2026
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.

2 participants