hipster-philology / pyrrha

A language-independent post-correction app for POS-tagging and lemmatization
https://pyrrha.huma-num.fr
MIT License
27 stars 16 forks source link

Localization #198

Closed ngawangtrinley closed 2 years ago

ngawangtrinley commented 4 years ago

Is your feature request related to a problem? Please describe. My linguist colleagues in China are mostly nomads who only speak Tibetan. We need to localize the app for use locally (using the app online isn't an option because of the great firewall of china)

Describe the solution you'd like I hope to localize pyrrha in Tibetan, is there an ideal or easy way to do it?

PonteIneptique commented 4 years ago

Hey ! I think it's a wonderful idea. There is two ways:

I would recommend the first, but given the fact I am still on leave, I'd probably say the second is the fastest.

ngawangtrinley commented 4 years ago

Ok, we'll start with english and wait for option number one then. I'm sure it'll be useful for other languages too. Enjoy your holiday!

ngawangtrinley commented 3 years ago

Hi @PonteIneptique, I'm reaching out for your Babel proposal. We've been using the tool with the option number two but it's a bit messy and the option one would help a lot.

PonteIneptique commented 3 years ago

Hey @ngawangtrinley, nice to hear from you :) Unfortunately, I am wrapping up my PhD and Babelizing Pyrrha would take me some time I can't give right now and until later this (civil) year. If you want to take this up, I could always look for tutorial online to share with you ?

ngawangtrinley commented 3 years ago

Sure, I'm interested if you have a good tutorial in mind.

Good luck for your PhD!

PonteIneptique commented 3 years ago

Hi and thanks ;) This seems to be the simplest one I could find ? https://medium.datadriveninvestor.com/translating-your-web-app-via-flask-babel-a1561376256c

lungsang commented 2 years ago

Hello @PonteIneptique, for pyrrha localization I am refering to this tutorial : https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n and after extraction and translation process, i have added the following codes in app/init.py module

babel = Babel(app)
@babel.localeselector
def get_locale():
      return 'bo_CN'

and also I made app=Flask(__name__ ) variable global, in order for it to be inherited by babel. It seems to be working fine, but get_locale(): isn't returning the requested language in the browser. Can you please have a look when time permits you in the PR #276

When I apply the above method in a simple flask project, its working fine.

I also tried to inherit create_app function by :

babel = Babel (create_app) 

and left the app = Flask(__name__)as it is. But then other errors are coming up.

PonteIneptique commented 2 years ago

Currently being done in #284