Skip to content

Fix translation string error in /terms#1307

Merged
katydidnot merged 4 commits intoWikipediaLibrary:masterfrom
suecarmol:suecarmol/T366620-fix-oauth-email-error
Jun 24, 2024
Merged

Fix translation string error in /terms#1307
katydidnot merged 4 commits intoWikipediaLibrary:masterfrom
suecarmol:suecarmol/T366620-fix-oauth-email-error

Conversation

@suecarmol
Copy link
Copy Markdown
Contributor

@suecarmol suecarmol commented Jun 17, 2024

Description

Fixes a translation string in Spanish which caused the /terms page to error out.

Rationale

This fixes the /terms page, which new users who picked Spanish as their UI language must agree to before using the library.

Phabricator Ticket

T366620

How Has This Been Tested?

Tested manually that the page is loading correctly in Spanish and in other languages.

Screenshots of your changes (if appropriate):

Types of changes

What types of changes does your code introduce? Add an x in all the boxes that apply:

  • 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 expected)
  • Minor change (fix a typo, add a translation tag, add section to README, etc.)

@suecarmol suecarmol marked this pull request as ready for review June 17, 2024 23:13
@suecarmol suecarmol requested review from jsnshrmn and katydidnot June 17, 2024 23:53
@suecarmol suecarmol changed the title Fix Unable to get Editor email address from Wikipedia. Fix translation string error in /terms Jun 18, 2024
Copy link
Copy Markdown
Member

@jsnshrmn jsnshrmn left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this! Can you explain the translation changes? Typically, if we have an issue with a message string, we change the message in source and then let cicd handle updates to the i18n files in locale.

Comment thread TWLight/users/oauth.py Outdated
Comment thread locale/en/LC_MESSAGES/django.po Outdated
Copy link
Copy Markdown
Contributor

@katydidnot katydidnot left a comment

Choose a reason for hiding this comment

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

I had the same question Jason had about the messages being populated from CI/CD.

And a minor fix:
When I ran the tests there was a linter error.
Here's the output:

WARN[0000] /Users/katherinegraessle/Workspace/TWLight/docker-compose.yml: `version` is obsolete
WARN[0000] /Users/katherinegraessle/Workspace/TWLight/docker-compose.override.yml: `version` is obsolete
[Tue Jun 18 15:26:31 UTC 2024]
black --target-version py311 --check TWLight
would reformat /app/TWLight/users/oauth.py

Oh no! 💥 💔 💥
1 file would be reformatted, 245 files would be left unchanged.
--- /app/TWLight/users/oauth.py	2024-06-18 15:00:44.018872+00:00
+++ /app/TWLight/users/oauth.py	2024-06-18 15:26:33.123470+00:00
@@ -261,17 +261,17 @@
         request.session["user_created"] = created

         # The authenticate() function of a Django auth backend must return
         # the user.
         return user
-
+
     # Implementation for https://docs.djangoproject.com/en/4.2/ref/contrib/auth/#django.contrib.auth.get_user
     def get_user(self, user_id):
         user = User.objects.filter(pk=user_id).first()
         if user is None:
             logger.warning("OAuthBackend.get_user: User does not exist")
-        return user
+        return user


 class OAuthInitializeView(View):
     """
     Ask Wikipedia for a temporary key/secret for the user, and redirect
You can fix these issues by running the following command on your host
docker exec CONTAINER /venv/bin/black -t py311 /app/TWLight ```


@suecarmol
Copy link
Copy Markdown
Contributor Author

Thanks for your work on this! Can you explain the translation changes? Typically, if we have an issue with a message string, we change the message in source and then let cicd handle updates to the i18n files in locale.

I think the translation changes happened when I ran bin/virtualenv_translate.sh force

@jsnshrmn
Copy link
Copy Markdown
Member

Thanks for your work on this! Can you explain the translation changes? Typically, if we have an issue with a message string, we change the message in source and then let cicd handle updates to the i18n files in locale.

I think the translation changes happened when I ran bin/virtualenv_translate.sh force

That makes sense; can you drop them from this pr?

@suecarmol suecarmol force-pushed the suecarmol/T366620-fix-oauth-email-error branch from 4bf97d6 to 2fdb670 Compare June 18, 2024 19:20
@suecarmol suecarmol force-pushed the suecarmol/T366620-fix-oauth-email-error branch from 2fdb670 to 6482c88 Compare June 18, 2024 19:31
@suecarmol
Copy link
Copy Markdown
Contributor Author

Thanks for your work on this! Can you explain the translation changes? Typically, if we have an issue with a message string, we change the message in source and then let cicd handle updates to the i18n files in locale.

I think the translation changes happened when I ran bin/virtualenv_translate.sh force

That makes sense; can you drop them from this pr?

Ok, after about an hour of fighting Git, I think this is ready

Copy link
Copy Markdown
Contributor

@katydidnot katydidnot left a comment

Choose a reason for hiding this comment

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

I think this looks good, but just had one question to help me butter understand the process: does the updated translation from the messages file auto-populate in translatewiki when you change it?

@jsnshrmn
Copy link
Copy Markdown
Member

I think this looks good, but just had one question to help me butter understand the process: does the updated translation from the messages file auto-populate in translatewiki when you change it?

We update the strings in our application code. Then our CI runs a job that extracts all of the messages for i18n. Then translatewiki pulls those messages. Then people update translatewiki. Then translate wiki commits new translations to our message files. But we should never update the non english non-qqq messages in master. And those messages (english and qqq) we should only update indirectly by updating our strings and comments in our source code.

@katydidnot
Copy link
Copy Markdown
Contributor

Then translate wiki commits new translations to ou

Thank you, this is helpful.

Comment thread locale/es/LC_MESSAGES/django.po Outdated
@suecarmol suecarmol force-pushed the suecarmol/T366620-fix-oauth-email-error branch from 6305a64 to b29663b Compare June 18, 2024 23:11
@katydidnot katydidnot merged commit f9cafa7 into WikipediaLibrary:master Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants