Draft
Conversation
frjo
requested changes
Feb 27, 2026
Member
frjo
left a comment
There was a problem hiding this comment.
Nice work, must have taken some time!
The error messages we never bothered with before, normal users should never see them hopefully. But no harm in having them translated.
hypha/apply/determinations/forms.py
Outdated
| "unique_together": "You have already created a determination for this submission", | ||
| "unique_together": _( | ||
| "You have already created a determination for this submission" | ||
| ), |
Member
There was a problem hiding this comment.
The forms in this file are old and only used on old installs, in reality only OTF I believe.
I do not think we should translate them, just adding a lot of strings to translate that are not really used.
Contributor
Author
There was a problem hiding this comment.
I've reverted the changes for that file. The text did appear very OTF-specific when I made the change originally, but I wasn't quite sure so thanks for giving me context!
013bcb9 to
6001e0c
Compare
85bef34 to
35b1949
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(This contribution was sponsored by DigitalHub.sh)
I've split this PR over several commits which are mostly independent of each other. I'm happy to open separate PRs if you think that'd be easier to review.
Explanations of the separate commits
Mark missing strings for translation
After a few unsuccessful attempts at scripting the identification of untranslated strings, I ended up reviewing all Python files manually.
The command I used to identify the relevant files was:
(That's all Python files, but excluding stuff like migrations, settings, ... (and empty files))
This change should have no impact for a site running the English version of Hypha.
Add missing strings for translations (templates)
Similar to the previous commit, I ended up reviewing all templates manually (
git ls-files '*.html'), adding{% trans %},{% blocktrans %}, or_(...)where needed.Again, this change should have no impact.
Add trimmed option to blocktranslate
This removes irrelevant whitespace in source strings, making it a bit nicer.
I used
git grep blocktrans | grep -vw trimmed | grep -v endblocktransto identify uses of{% blocktrans %}without thetrimmedargument, excluding lines that also included{% endblocktrans %}on the same line.This is technically a breaking change, but it only introduces whitespace changes to HTML templates, which is irrelevant.
Use
{% blocktranslate trimmed %}to break down long linesThis one just makes templates a little bit more readable as it breaks very long lines into more manageable pieces.
Again, it can introduce whitespace changes to the HTML, but should not have any effect to the source strings.
Added
verbose_nameandverbose_name_pluralto all modelsSome models already has a translated
verbose_nameorverbose_name_plural, but it was inconsistent (and quite rare). This change adds these attributes to all models.I used
git ls-files '**/models/*.py'andgit ls-files '**/models.py'to find all models, then went through the files manually to add the missingverbose_nameandverbose_name_plural.I decided to omit the plural form for model classes inheriting from
BaseSiteSettingssince it didn't seem to make sense.I also opted to use lower case (like
_("foo bar")for modelFooBar) to match Django's own default behavior, but I usedFoo Barin a few instances where the model already had averbose_namethat used titlecase.Next steps
I ran out of time to complete all my objectives and I've still got some translation-related tasks I wanted to get to. I'm happy to open issues for these if you think they're relevant:
verbose_nameto all declared model fields (and maybe form fields as well). This can probably be scripted somewhat, ideally with a linter that would catch the introducing of future untranslated strings.gettextis used at the module level instead ofgettext_lazyas this could indicate some possible bugs (visible in a multi-language setup where the user is not using the default language).{% trans "Application" %} {{ application_id }} {% trans "updated on" %} {{ date }} {% trans "by" %} {{ author.name }}should be rewritten to have the whole sentence in a singleblocktrans, or when not possible small words likebyshould be given a context because they're likely to be translated differently for different sentences.