crusat / python-zodiac-sign Goto Github PK
View Code? Open in Web Editor NEWZodiac Sign by date
License: MIT License
Zodiac Sign by date
License: MIT License
You can add this in order to support Zodiacs in Greek:
el_dict = (
(0, "Κριός"),
(1, "Ταύρος"),
(2, "Δίδυμοι"),
(3, "Καρκίνος"),
(4, "Λέων"),
(5, "Παρθένος"),
(6, "Ζυγός"),
(7, "Σκορπιός"),
(8, "Τοξότης"),
(9, "Αιγόκερως"),
(10, "Υδροχόος"),
(11, "Ιχθείς"),
)
language_dict = {
'en_US': en_dict,
'ru_RU': ru_dict,
'pt_BR': pt_dict,
'pt_PT': pt_dict,
'el': el_dict,
'el_CY': el_dict,
'el_GR': el_dict,
None: en_dict
}
I suggest when there isn't support for a specific locale to fallback to english:
def _(word_index):
language = locale.getlocale()
return language_dict.get(language[0], 'en_US')[word_index][1]
It would be nice if there would be some way to set up localization for the zodiac strings that the library returns.
I'm not sure if this is technically possible to do, but I'd suggest using some dedicated program like gettext.
Otherwise, a way to set a locale when requesting a zodiac string would also work.
The code needs to be changed like this:
def _(word_index):
language = locale.getlocale()
return language_dict.get(language[0], language_dict.get('en_US'))[word_index][1]
As of now the code is
def _(word_index):
language = locale.getlocale()
return language_dict.get(language[0], 'en_US')[word_index][1]
For me,
language = locale.getlocale()
language[0]
'English_United States'
For the code as of now, 'English_United States' is not included in the language_dict dictionary. So a string 'en_US' is returned. And you can see there will be errors later.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.