Language correct date&time display in python plugins via setlocale() function
-
ThE MaStEr
2012-03-19
-
Hi,
I have made shell script which enables installing locale files which are needed for correct languge:
string comparison (LC_COLLATE)
lower & upper string conversion, isupper & islower testing (LC_CTYPE)
monetary formatting (LC_MONETARY)
decimal separator (LC_NUMERIC)
date & time formating (LC_TIME)
After installing locale files for your Language you can use all "language critical" functions in your python scripts (converters, renderers, plugins, etc.)
All you need is to run locale_files.sh script, then you have to set proper language locale argument in the setlocale() function in some python files as you can see below:
كود PHP:
def __init__(self, type):
try:
setlocale(LC_ALL, language.getLanguage())
except:
pass
For example, you can see my small modification of the ClockToText.py converter which enables to display date/time string according to user language localization.
NUMERICABLE ident 0084 02.08.2011
Last data full 09-09-2011
شرح تشغيل سيرفر التايجر عن طريق فلاشات USB /3g
Mgcamd 1.37 for EDG Image
LD-v04-dm800-28052011
Premier League TV HD=Eutelsat W2A
C4, Nova order Chilean miners doc
كل ما تحتاج اليه لصورة Merlin 3 للدريم بوكس DM800SE
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.