-
Notifications
You must be signed in to change notification settings - Fork 127
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
Enlarge Language Code #332
Comments
Hello, |
I'm storing different translation suggestion for one language by simple use different language_codes for each. Creating a unique language_code is also quit simple by adding an incremental counter. But the problem is to use it in parallel functions, because you have to lock this small logic part for each creation which causes a big overhead. My proposal would be to enlarge the max_length so that you can store a unique code without any logic that have to be looked. The max size would be 36 characters if we want to support python core uuid (https://pymotw.com/3/uuid/index.html 36 would be the length of the hex value) or 22 if we want to support a library like https://github.com/skorokithakis/shortuuid |
It seems you are digging into hvad's internals in a very unexpected way. I don't really want to encourage this as it breaks the fundamental paradigm of hvad, that translations are for displaying only and do not take active part in the data model or business logic. In your example, you attach translation suggestions to an object. It is not the same concept as an hvad translation. I understand they are really close and it feels intuitive to try and implement them by re-using hvad translations. Yet hvad would work the other way around: attach translations to suggestions. I would suggest you split it into:
Suggestions are part of your business logic, and pushing that into hvad's own data model risks creating incompatibilities with future versions. I guess if you insist on doing this anyway, I could make it possible to override the |
Thanks for your advice. |
Next hvad release will allow overriding |
Could we enlarge the max_length value from current 15 to 36, so you can store easily python UUIDs in there?
With the current value you have to do more logic to avoid Errors from ('language_code', 'master') unicity vialation.
The text was updated successfully, but these errors were encountered: