Skip to content

Conversation

QunixHacker
Copy link

Support Chinese Unicode As ACC_NAME

Support Chinese Unicode As ACC_NAME
@QunixHacker
Copy link
Author

This PR Maybe is not the best solution to solve locale/i18n AccountName

Dear blais, if you have purpose to do something with i18n/locale AccountName or AccountType; I Would like do something and ask you to permit me to be a committer for this project.

I will do some work like

  1. analysis diffrent language(eg. Chinese\JP) usage

Copy link
Collaborator

@dnicolodi dnicolodi left a comment

Choose a reason for hiding this comment

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

The idea looks good, however the implementation contains a mistake. We would also need a better commit message describing what the commit does in the first sentence. The current commit message also refers to ACC_NAME which is an entity that does not exist. A test that verifies that things work as expected would also be nice.

# Nd: Decimal numbers.
ACC_COMP_TYPE_RE = r"[\p{Lu}][\p{L}\p{Nd}\-]*"
ACC_COMP_NAME_RE = r"[\p{Lu}\p{Nd}][\p{L}\p{Nd}\-]*"
ACC_COMP_NAME_RE = r"[\p{Lu}\p{Nd}]\p{Han}][\p{L}\p{Nd}\p{Han}\-]*"
Copy link
Collaborator

Choose a reason for hiding this comment

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

From my limited understanding of Unicode properties and scripts not using the Latin alphabet, I think adding the Han character class to the regular expression is correct. However, there is a syntax error in the regular expression: there are two closing brackets ] but just one opening one [. I infer that this change has not been tested. Also, this changes the regular expression for the account name components after the first, but it does not change the one for the leading component (ACC_COMP_TYPE_RE vs ACC_COMP_NAME_RE). I think both need to be changed in a similar way.

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.

2 participants