title: Flask-Babel working in development but not translating in production
body: <p>I have got Flask-Babel set up and working correctly on my localhost development app (with two languages: <code>en_GB</code> and <code>en_US</code>).</p>
  <p>However, when I try to switch languages on the production app, it does nothing. The <code>get_locale()</code> function is returning the correct language (and I can see it is being called multiple times on a page refresh, suggesting it is being called for each required translation), but no actual translations appear.</p>
  <p>As I say, it is working perfectly in the development app and I can't see any reason why the behaviour should be any different in production. Any ideas would be much appreciated.</p>
  <p>The translation files (<code>messages.mo</code> and <code>messages.po</code>) are stored in <code>translations/en_us/LC_MESSAGES</code>.</p>
  <p><strong>config.py</strong></p>
  <pre><code>LANGUAGES = ['en_GB', 'en_US']
  </code></pre>
  <p><strong>babel.cfg</strong></p>
  <pre><code>[jinja2: megaseatingplan/templates/**.html]
  extensions=jinja2.ext.autoescape,jinja2.ext.with_
  </code></pre>
  <p><strong>__init__.py</strong></p>
  <pre><code># Initialise flask-babel
  babel = Babel(app)
  
  @babel.localeselector
  def get_locale():
      try:
          print(&quot;Language loaded from current_user: &quot;+str(current_user.language))
          return current_user.language
      except:
          print(&quot;Language loaded from browser: &quot;+str(request.accept_languages.best_match(app.config['LANGUAGES'])))
          return request.accept_languages.best_match(app.config['LANGUAGES'])
  </code></pre>
  <p><strong>Function for manually choosing language</strong></p>
  <pre><code>@app.route('/switch_language/&lt;language&gt;')
  @login_required
  def switch_language(language):
      current_user.language = language
      db.session.commit()
  
      track_event(&quot;User&quot;, &quot;Switch language&quot;, label=language, value=0, userid=current_user.userid)
  
      if language == &quot;en_GB&quot;:
          flash(&quot;Language switched to English (UK)&quot;)
      elif language == &quot;en_US&quot;:
          flash(&quot;Language switched to English (US)&quot;)
  
      return redirect(url_for('home'))
  </code></pre>
  <p><strong>EDIT:</strong>
  Some extra info. I have confirmed that the <code>BABEL_TRANSLATION_DIRECTORIES</code> is pointing to the correct place and have also use <code>list_translations()</code> to confirm that it is finding my <code>en_US</code> translation file.</p>