Skip to content

Instantly share code, notes, and snippets.

@pypeach
Last active July 23, 2018 12:53
Show Gist options
  • Save pypeach/a9d47c11466997e67eaac41b5e91ce3b to your computer and use it in GitHub Desktop.
Save pypeach/a9d47c11466997e67eaac41b5e91ce3b to your computer and use it in GitHub Desktop.
メッセージ出力
# 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)
@pypeach
Copy link
Author

pypeach commented Jul 21, 2018

get_messageメソッドを廃止

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment