如何设置对 Windows 和 Unix 有效的语言环境(法语)?
我的完整机器人测试是:
*** Settings ***
Library SeleniumLibrary
Library DateTime
*** Keywords ***
Get Next Week French date
Evaluate locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8') locale
${today}= Get Time
${tomorrow}= Add Time To Date ${today} 1 days
${three_day_after}= Add Time To Date ${today} 3 days
${today_day}= Convert Date ${today} result_format=%a
Log To Console ${today_day}
${next_date}= Set Variable If "${today_day}"=="ven." ${three_day_after} ${tomorrow}
${next_week}= Add Time To Date ${next_date} 7 days
${day_of_week}= Convert Date ${next_week} result_format=%A
${day_of_week_fr}= Evaluate """${day_of_week}""".title()
${day}= Convert Date ${next_week} result_format=%d
${month}= Convert Date ${next_week} result_format=%B
[Return] ${day_of_week_fr} ${day} ${month}
test
${val}= Get Next Week French date
Log To Console ${val}
*** Test Cases ***
MY SUPER TEST
[Tags] foo|AC0
Given test
在我的本地机器上(Windows 7)确定:
Evaluate locale.setlocale(locale.LC_ALL, 'french') locale
在我的 CI 机器(Unix)上可以:
Evaluate locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8') locale
如果我fr_FR.UTF-8在本地机器上使用,则会出现此错误:
locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')' failed: unsupported locale setting
编辑
可能是 Python 2 (fr_FR.UTF-8) Vs。Python 3 (法语) ??
慕斯709654
相关分类