wxPython-国际化设置
得益于gettext的支持,wxpython可以使用gettext库来让你的应用程序支持多国语,走向世界.在wxpython中有个比较方便的脚本mki18n.py,来自动生成.po和.mo.下面是一个自动生成的脚本:
gen_lang.sh放在你工程目录的lang或languages目录下,注意:这里生成的message.pot中的CHARSET已经要替换掉,否则程序无法执行,例如,替换成"UTF-8".
#!/bin/bash # mki18n.py依赖app.fil,里面是所有的py文件列表 find ../ -iname "*.py" -print >app.fil # 生成.po文件,domain一定要换成自己的 python mki18n.py -v -p --domain=your_application_name ./ # 上句命令,会生成message.pot文件,这个是一个模板文件. # 如果需要zh_CN的翻译,可以拷贝message.pot为 your_applaciton_name_zh_CN.po # 那么每次执行后就会生成your_applaciton_name_zh_CN.po.new,比较一下,合入新的未翻译的条目吧. # 生成.mo文件 # 这个会生成类似 # zh_CN/LC_MESSAGES/your_applaction_name.po python mki18n.py -m -e -v --domain=your_application_name --moTarget=./
在应用程序中,你只需要调用下面的install函数即可.
# coding: utf-8 import gettext def install(localdir, lang): gettext.translation("sgsgame", localedir=localdir, languages=lang).install(True)
例如:
# languages install import util langdir = os.path.join(home, "lang") try: util.i18n.install(langdir, ['zh_CN']) except: traceback.print_exc() util.i18n.install(langdir, ['en_US'])
然后,应用程序中,所有 _()包括的字符串都会被翻译成中文,当然,前提是你已经在po文件中翻译好了.
参考连接: http://wiki.wxpython.org/Internationalization
2024年1月15日 20:42
"I absolutely adore this information as this is going to be very difficulty time for the whole world. great things are coming for sure
"
2024年2月20日 19:35
I am constantly surprised by the amount of information accessible on this subject. What you presented was well researched and well written to get your stand on this over to all your readers.
2024年2月20日 19:35
These are all really solid tips. I can’t tell you how often I see a comment on one of the blogs I write for that amounts to “nice post” and nothing more. I’ve even worked at a couple of sites that delete comments that don’t add to the discussion!
2024年2月20日 19:36
I spend time people’s writing. It has the excellent to consider you demonstrate around thoughts together with the intellect and also res while doing this very important topic is sometimes successfully deemed.
2024年2月20日 20:17
Awesome blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed .. Any recommendations? Many thanks!
2024年2月20日 20:18
Great! Information you have been shared, it’s really very impressive and easy to understand please share more useful information like this. Thank you
2024年2月20日 20:18
Your blog is very helpful for beginners who want to learn Data science. I am also a Data science developer. I had done Data Science course from TGC India. They offer a variety of tutorials covering everything from the processes of Data Science to how to get started with Data Science.
2024年2月20日 21:14
Great! Information you have been shared, it’s really very impressive and easy to understand please share more useful information like this. Thank you
2024年2月20日 21:14
These are all really solid tips. I can’t tell you how often I see a comment on one of the blogs I write for that amounts to “nice post” and nothing more. I’ve even worked at a couple of sites that delete comments that don’t add to the discussion!
2024年2月20日 21:14
I love how your blog delves into diverse topics, providing a well-rounded and enriching reading experience. It’s my go-to source for learning something new every day.
2024年2月20日 21:26
Thanks for writing such a lovely and informative post for us. Now I will keep visiting your blog at regular intervals. And also I want to request you to write more such posts in the future, so that I can refer my more friends to visit on your blog. Keep Blogging!!!
2024年2月20日 21:27
The Offscreen Film Festival 2018 promises to be an unforgettable cinematic experience. With a lineup of thought-provoking and boundary-pushing films, this festival is set to captivate audiences from all walks of life.
2024年2月20日 21:28
Awesome blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally overwhelmed .. Any recommendations? Many thanks!
2024年2月20日 22:11
They Have Been In This Requiring Some Undertaking. In this way, They Respect The Attitude And Need Of Their Clients In a Clear Manner. . These Call Young women Respect That Different Clients Are Ensured Going To Have Different Systems.
2024年2月20日 22:13
I’d also like to state that most of those that find themselves without the need of health insurance are normally students, self-employed and those that are jobless. More than half from the uninsured are under the age of Thirty five. They do not sense they are in need of health insurance since they are young along with healthy. Their income is normally spent on real estate, food, and also entertainment. Some people that do represent the working class either whole or not professional are not given insurance by means of their jobs so they go without because of the rising valuation on health insurance in america. Thanks for the tips you discuss through your blog.
2024年2月20日 22:14
Thanks for sharing very Nice Information for Us. Otherwise if anyone want to learn Python, Data Sciences and Python Frameworks. Expert Trainers, Project based Training, Placement assistance makes us different from others
2024年2月20日 22:26
his is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.
2024年2月20日 22:26
Very impressive and interesting blog found to be well written in a simple manner that everyone will understand and gain the enough knowledge from your blog being more informative is an added advantage for the users who are going through it. Once again nice blog keep it up.
2024年2月20日 22:27
Your blog is very helpful for beginners who want to learn Data science. I am also a Data science developer. I had done Data Science course from TGC India. They offer a variety of tutorials covering everything from the processes of Data Science to how to get started with Data Science.
2024年2月20日 22:28
They Have Been In This Requiring Some Undertaking. In this way, They Respect The Attitude And Need Of Their Clients In a Clear Manner. . These Call Young women Respect That Different Clients Are Ensured Going To Have Different Systems.
2024年2月20日 22:28
Driving forward Through You In Normal Need To Partake In The Standard Expansions Of Having A Standard Presence Destruction Then You Truly Need Not Go Out Conventionally. .You Can Other Than Help The Relationship Of Our Escorts Who Is Available to Driving Forward And In All Pieces Of The Country.
2024年2月20日 22:29
Very impressive and interesting blog found to be well written in a simple manner that everyone will understand and gain the enough knowledge from your blog being more informative is an added advantage for the users who are going through it. Once again nice blog keep it up.
2024年2月20日 23:05
Thank you for another informative blog. Where else could I get that kind of info written in such an ideal way? I’ve a project that I am just now working on, and I have been on the look out for such information.
2024年2月20日 23:05
It's my first time here. I found this board and found it really helpful and it helped me out a lot. I want to give something back and help others like you helped me.
2024年2月20日 23:05
I’d also like to state that most of those that find themselves without the need of health insurance are normally students, self-employed and those that are jobless. More than half from the uninsured are under the age of Thirty five. They do not sense they are in need of health insurance since they are young along with healthy. Their income is normally spent on real estate, food, and also entertainment. Some people that do represent the working class either whole or not professional are not given insurance by means of their jobs so they go without because of the rising valuation on health insurance in america. Thanks for the tips you discuss through your blog.
2024年2月20日 23:24
good day i am so thrilled I placed your blog, I truly located you via mistake, even as i was looking on google for something else, anyways i am right here now and will just like to say thank for a splendid post and a all round unique website. Please do preserve up the exceptional paintings.
2024年2月20日 23:40
Hi there! Nice material, do keep me posted when you post something like this again! I will visit this blog leaps and bounds for more quality posts like it. Thanks.
2024年2月20日 23:41
I love this project (Create an animal/plant) but I am not able to open the document/image up to print or even display a clear copy to use in the classroom. Is there any way you could send me a copy of this? Thank you for your time.
2024年2月20日 23:41
Definitely believe that which you said. Your favorite justification appeared to be on the net the simplest thing to be aware of. I say to you, I certainly get annoyed while people consider worries that they plainly don’t know about. You managed to hit the nail upon the top and defined out the whole thing without having side-effects , people can take a signal.
2024年2月21日 00:06
Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share.
2024年2月21日 00:06
I love this project (Create an animal/plant) but I am not able to open the document/image up to print or even display a clear copy to use in the classroom. Is there any way you could send me a copy of this? Thank you for your time.
2024年2月21日 00:07
I am constantly surprised by the amount of information accessible on this subject. What you presented was well researched and well written to get your stand on this over to all your readers.
2024年2月21日 00:07
I spend time people’s writing. It has the excellent to consider you demonstrate around thoughts together with the intellect and also res while doing this very important topic is sometimes successfully deemed.
2024年2月21日 00:08
These are all really solid tips. I can’t tell you how often I see a comment on one of the blogs I write for that amounts to “nice post” and nothing more. I’ve even worked at a couple of sites that delete comments that don’t add to the discussion!
2024年2月21日 00:28
I spend time people’s writing. It has the excellent to consider you demonstrate around thoughts together with the intellect and also res while doing this very important topic is sometimes successfully deemed.
2024年2月21日 00:28
These are all really solid tips. I can’t tell you how often I see a comment on one of the blogs I write for that amounts to “nice post” and nothing more. I’ve even worked at a couple of sites that delete comments that don’t add to the discussion!
2024年2月23日 19:43
A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post