I18n example patch (added docs and fixed typos) (#419)

* Update i18n example

1. Replaced one file translation to all project folder translation. It's more usable case. 
2. `For e.g.` --> `E.g.`. E.g. is short for `exempli gratia` which means simply “for example.” So if you write for e.g., you are in effect writing `for for example`. 
3. `xargs` replased with serveral lines, `xargs` is not appliable for Microsoft Windows users. 
4. Added info about translation tools. 
5. Minor edits.

* i18n middlaware typo fix

* i18n example header typo fix
This commit is contained in:
Oleg A 2020-09-10 22:32:56 +03:00 committed by GitHub
parent 9ab2945267
commit 56ffa00c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View file

@ -59,13 +59,13 @@ class I18nMiddleware(BaseMiddleware):
with open(mo_path, 'rb') as fp:
translations[name] = gettext.GNUTranslations(fp)
elif os.path.exists(mo_path[:-2] + 'po'):
raise RuntimeError(f"Found locale '{name} but this language is not compiled!")
raise RuntimeError(f"Found locale '{name}' but this language is not compiled!")
return translations
def reload(self):
"""
Hot reload locles
Hot reload locales
"""
self.locales = self.find_locales()