mirror of https://github.com/kianby/stacosys
externalize localized application messages
parent
4d52229e4d
commit
69f1c35ef5
@ -0,0 +1,17 @@
|
||||
import configparser
|
||||
import os
|
||||
|
||||
|
||||
class Messages:
|
||||
def __init__(self):
|
||||
self.property_dict = {}
|
||||
|
||||
def load_messages(self, lang):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(os.path.join(os.path.dirname(__file__), 'messages_' + lang + '.properties'))
|
||||
|
||||
for key, value in config.items('messages'):
|
||||
self.property_dict[key] = value
|
||||
|
||||
def get(self, key):
|
||||
return self.property_dict.get(key)
|
@ -0,0 +1,6 @@
|
||||
[messages]
|
||||
login.failure.username=Username or password incorrect
|
||||
logout.flash=You have been logged out.
|
||||
admin.comment.notfound=Comment not found.
|
||||
admin.comment.approved=Comment published.
|
||||
admin.comment.deleted=Comment deleted.
|
@ -0,0 +1,6 @@
|
||||
[messages]
|
||||
login.failure.username=Identifiant ou mot de passe incorrect
|
||||
logout.flash=Vous avez été déconnecté.
|
||||
admin.comment.notfound=Commentaire introuvable
|
||||
admin.comment.approved=Commentaire publié
|
||||
admin.comment.deleted=Commentaire supprimé
|
Loading…
Reference in New Issue