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

fix: Fix translation of application status. feat: Add BorrowerSector. Use gettext to translate enums. #382

Merged
merged 19 commits into from
Aug 22, 2024

Conversation

jpmckinney
Copy link
Member

@jpmckinney jpmckinney commented Aug 21, 2024

@jpmckinney
Copy link
Member Author

@yolile FYI this PR contains a fix for #357, where the capitalized application statuses in applications/export/{lang} wouldn't be translated. You can merge it already if needed. Otherwise I'll add more commits for #362

@coveralls
Copy link

coveralls commented Aug 21, 2024

Pull Request Test Coverage Report for Build 10513517000

Details

  • 39 of 73 (53.42%) changed or added relevant lines in 12 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on 362-translate-enums at 84.429%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/routers/lenders.py 1 2 50.0%
app/dependencies.py 6 8 75.0%
app/routers/applications.py 1 3 33.33%
app/utils/tables.py 0 2 0.0%
app/auth.py 1 4 25.0%
app/routers/users.py 2 5 40.0%
app/babel.py 0 21 0.0%
Totals Coverage Status
Change from base Build 10513478531: 84.4%
Covered Lines: 1811
Relevant Lines: 2145

💛 - Coveralls

@yolile
Copy link
Member

yolile commented Aug 21, 2024

Feel free to add more commits

@jpmckinney jpmckinney force-pushed the 362-translate-enums branch from 9ba7eca to e5c7c28 Compare August 21, 2024 21:51
…_() signature to allow language to be overridden in tests. Get tests passing in null and "es" languages.
@jpmckinney
Copy link
Member Author

jpmckinney commented Aug 21, 2024

@yolile There are some error messages for you to translate (Or, we can let them continue to be returned in English, and relax the i18n.yml workflow). You can add your commits to finish #362 (or create a new PR).

Note: ERROR_CODES.APPLICATION_LAPSED was added in d15c2d8, but it has no translation in the frontend (as of today). I set it to just "Application lapsed" in English, but feel free to change and run https://credere.readthedocs.io/en/latest/contributing/index.html#update-translations

@jpmckinney jpmckinney force-pushed the 362-translate-enums branch from 3f4b1dd to 764c40f Compare August 21, 2024 22:54
@yolile
Copy link
Member

yolile commented Aug 22, 2024

I get this error when I run pybabel extract -F babel.cfg -o messages.pot .

extracting messages from README.rst (classes="ApplicationStatus,BorrowerDocumentType,BorrowerSize,BorrowerSector")
Traceback (most recent call last):
  File "/home/yolile/development/credere-backend/.ve/bin/pybabel", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/frontend.py", line 999, in main
    return CommandLineInterface().run(sys.argv)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/frontend.py", line 925, in run
    return cmdinst.run()
           ^^^^^^^^^^^^^
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/frontend.py", line 523, in run
    for filename, lineno, message, comments, context in extracted:
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/extract.py", line 217, in extract_from_dir
    yield from check_and_call_extract_file(
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/extract.py", line 281, in check_and_call_extract_file
    for message_tuple in extract_from_file(
                         ^^^^^^^^^^^^^^^^^^
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/extract.py", line 323, in extract_from_file
    return list(extract(method, fileobj, keywords, comment_tags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yolile/development/credere-backend/.ve/lib/python3.11/site-packages/babel/messages/extract.py", line 441, in extract
    raise ValueError(f"Unknown extraction method {method!r}")
ValueError: Unknown extraction method 'enum'

@jpmckinney
Copy link
Member Author

pip install -e . (mentioned earlier under setup)

app/utils/tables.py Outdated Show resolved Hide resolved
@yolile
Copy link
Member

yolile commented Aug 22, 2024

I'm not sure why "Not authenticated" is not being translated, not sure if we are mocking JWT somewhere

@jpmckinney
Copy link
Member Author

We can create a follow-up issue to translate model names, if that's desired.

@yolile yolile merged commit 1f77b53 into main Aug 22, 2024
10 checks passed
@yolile yolile deleted the 362-translate-enums branch August 22, 2024 18:24
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