title: python gettext: specify locale in _()
body: <p>I am looking fo a way to set the language on the fly when requesting a translation for a string in gettext. I'll explain why : </p>
  
  <p>I have a multithreaded bot that respond to users by text on multiple servers, thus needing to reply in different languages.
  The <a href="http://www.enseignement.polytechnique.fr/informatique/INF478/docs/Python3/library/gettext.html#changing-languages-on-the-fly" rel="nofollow" title="doc">documentation</a> of gettext states that, to change locale while running, you should do the following : </p>
  
  <pre><code>import gettext # first, import gettext
  
  lang1 = gettext.translation('myapplication', languages=['en']) # Load every translations
  lang2 = gettext.translation('myapplication', languages=['fr'])
  lang3 = gettext.translation('myapplication', languages=['de'])
  
  # start by using language1
  lang1.install()
  
  # ... time goes by, user selects language 2
  lang2.install()
  
  # ... more time goes by, user selects language 3
  lang3.install()
  </code></pre>
  
  <p>But, this does not apply in my case, as the bot is multithreaded :</p>
  
  <p>Imagine the 2 following snippets are running at the same time :</p>
  
  <pre><code>import time
  import gettext 
  lang1 = gettext.translation('myapplication', languages=['fr'])
  lang1.install()
  message(_("Loading a dummy task")) # This should be in french, and it will
  time.sleep(10)
  message(_("Finished loading")) # This should be in french too, but it wont :'(
  </code></pre>
  
  <p>and </p>
  
  <pre><code>import time
  import gettext 
  lang = gettext.translation('myapplication', languages=['en'])
  time.sleep(3) # Not requested on the same time
  lang.install()
  message(_("Loading a dummy task")) # This should be in english, and it will
  time.sleep(10)
  message(_("Finished loading")) # This should be in english too, and it will
  </code></pre>
  
  <p>You can see that messages sometimes are translated in the wrong locale. 
  But, if I could do something like <code>_("string", lang="FR")</code>, the problem would disappear !</p>
  
  <p>Have I missed something, or I'm using the wrong module to do the task...
  I'm using python3</p>