我做了一个小 Python 程序:
# -*- coding: utf-8 -*-
""" Program that ask for the birth date and return the day name of the birth """
from datetime import datetime
def ask_birthdate():
""" Raw input of the birth date """
date = raw_input("Enter your birth date (DD-MM-YYYY) : ").strip()
return datetime.strptime(date, '%d-%m-%Y')
def birthday(date):
""" Localized day of birth """
return date.strftime('%A')
if __name__ == "__main__":
date = ask_birthdate()
print u"You was born a %s" % birthday(date)
很简单,但我想翻译一下。首先是 IHM 文本(输入您的出生日期)和(您的出生日期)然后我还希望翻译当天的名称。
在文档中,我看到它应该是本地化的,但是我应该如何将程序配置为本地化?