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 server.py to accept local languages such as es-419 #1399

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

erauld
Copy link
Contributor

@erauld erauld commented Oct 3, 2024

fix regex to accept numbers

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. labels Oct 3, 2024
@erauld
Copy link
Contributor Author

erauld commented Oct 3, 2024

this regex has even more support to bcp 47 languages:

^[a-zA-Z]{2,3}(-[a-zA-Z]{4})?(-[A-Z]{2}|\d{3})?(-[a-zA-Z0-9]{5,8})*(-[a-wy-zA-WY-Z0-9](-[a-zA-Z0-9]{2,8})+)*(-x(-[a-zA-Z0-9]{1,8})+)?$

I haven't tested yet

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Oct 10, 2024
@dokterbob dokterbob enabled auto-merge (squash) October 10, 2024 16:37
Copy link
Collaborator

@dokterbob dokterbob left a comment

Choose a reason for hiding this comment

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

LGTM. I added a regression test and validated that your regexp passes it.

@dokterbob dokterbob merged commit 988eea6 into Chainlit:main Oct 10, 2024
15 checks passed
@dokterbob
Copy link
Collaborator

@erauld Thanks for the contrib. Next time, be sure to mention # to get everything auto-referenced. You're also hereby challenged to provide regression tests! ;)

@DanielVelaJ Thanks for the report!

@erauld
Copy link
Contributor Author

erauld commented Oct 10, 2024

Thanks @dokterbob !!

dokterbob added a commit that referenced this pull request Oct 22, 2024
…1352.

* Update server.py to accept local languages such as es-419
* Regression test for #1352.

Ref: https://en.wikipedia.org/wiki/IETF_language_tag

---------

Co-authored-by: Mathijs de Bruin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Pertains to the Python backend. size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants