Last active
July 23, 2018 12:53
-
-
Save pypeach/a9d47c11466997e67eaac41b5e91ce3b to your computer and use it in GitHub Desktop.
メッセージ出力
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
import configparser | |
import os | |
from app.util import app_config | |
""" | |
メッセージ出力を行う | |
""" | |
__author__ = "t.ebinuma" | |
__version__ = "1.3" | |
__date__ = "14 July 2018" | |
def get_message(code): | |
""" | |
メッセージコードからメッセージを取得する | |
""" | |
prop = configparser.RawConfigParser() | |
# メッセージファイルを読み込む | |
# (windowsの場合はcp932になるため明示的にencodingを指定する) | |
prop.read(os.path.join(app_config.get_resource_path(), 'messages_ja.properties'), encoding='UTF-8') | |
# メッセージコードからメッセージを取得する | |
return code + ":" + prop.get('messages', code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get_messageメソッドを廃止