Replies: 5 comments
|
Hi @p-maciej, This looks like a significant undertaking! I've always been hesitant about localizing the Otter Wiki due to the complexity. While your self-build solution demonstrates initiative, it has some scalability challenges. For example, relying on extra keys to retrieve translations like toast(get_locale("toast_not_approved"), "warning")`)A more straightforward approach would be to use the English text directly as the translation key e.g. toast(get_locale("You are not approved yet."), "warning")`)I strongly suggest leveraging Flask-Babel and its associated tools for a more robust and maintainable localization solution. It offers much better support for extensibility. Please don't let this criticism discourage you! Your work convinced me to add localizing An Otter Wiki to the roadmap. |
|
P.S. Not sure if Flask-Babel is the best option, just the only one that I ever checked .. in this tutorial: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n |
|
In some languages using english as a key might break the context in translation. For example, sometimes is necessary to use prepositions as seperate key, like here: "diff_to": "z", "draft_exists_for": "Dla", "draft_ago": "temu". In different sentences preposition can have different translation, for example "for" can be translated to "dla", "za", "do" in different contexts. To avoid this situation whole sentence would be needed to be applied at once always. I will explore if this is possible. Regarding your suggestion, I thnik I could write a python script to convert current implementation to use english as a key and re-use current work. |
|
If you would like to implement your own localization code let me know when you are ready. I can translate the strings into Polish. |
Yes localization is hard, thats why I've hesitated to add this feature ;) What I meant is not to split the words apart, just the the entire sentence as key and if no translation exists as default. For example when a new feature is added and Babel is used for localization, the dev can just write |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I planned to make a wiki in my own language, so I have built minimal multilingual support for my purposes to keep my sense of aesthetics happy. You can find it here: link.
Not everything is supported yet. For example the documentation is still untouched. Most of the interface changes I already tested manually, but propably some additional polishes and verification will be needed anyway. I used SITE_LANG to set language if it is supported, if not it falls back to english.
This is a quiet extensive change so firstly i wanted to ask if you are interested in support of this functionality. In this shape this is enough for me, and I can polish this out if you are interested in introducing this feature.
The project is excellent, and thank you for the hard work and your ongoing support!
All reactions