Jump to content

mesterlum

Inactive Member
  • Posts

    4
  • Joined

  • Last visited

  • Feedback

    0%

About mesterlum

Informations

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mesterlum's Achievements

Newbie

Newbie (1/16)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

4

Reputation

  1. good job my friend, and thanks for complete the script for clients.
  2. i do not understand buddy, if you refer for "requests" is a module from python API. But, my idea is establish initial lang automatic.
  3. M2 Download Center Download Here ( Internal ) Hello, i maked a simple script for get initial lang... the proposite is automate the choice of the languaje (for servers internationals). Unknown if there will be something similar Source: import requests class CurrentPositionForLang: # Code langs __LANGS_AVAILABLES = ("ES", "EN", "FR", "TR",) # County with lang __COUNTRY_CODES_WITH_LANG = ( ("MX", __LANGS_AVAILABLES[0]), ("US", __LANGS_AVAILABLES[1]), ("FR", __LANGS_AVAILABLES[2]), ("ES", __LANGS_AVAILABLES[0]), ("TR", __LANGS_AVAILABLES[3]) ) @staticmethod def get_lang(): lang = "US" # Default lang for errors try: r = requests.get("[Hidden Content]") if r.status_code != 200: return lang countryCode = r.json()["countryCode"] for country, langCountry in CurrentPositionForLang.__COUNTRY_CODES_WITH_LANG: if countryCode == country: return langCountry # If not finded return default return lang except requests.exceptions.ConnectionError: return lang For utilicy this class only call this method: CurrentPositionForLang.get_lang() this return only String "US, ES..." If you need add more langs, in this fields add the country and the code. __LANGS_AVAILABLES = ("ES", "EN", "FR", "TR",) # County with lang __COUNTRY_CODES_WITH_LANG = ( ("MX", __LANGS_AVAILABLES[0]), ("US", __LANGS_AVAILABLES[1]), ("FR", __LANGS_AVAILABLES[2]), ("ES", __LANGS_AVAILABLES[0]), ("TR", __LANGS_AVAILABLES[3]) ) This is the standar for code countrys: [Hidden Content]
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.