This repository has been archived by the owner on Dec 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add zh_CN Providers #864
Merged
Merged
Add zh_CN Providers #864
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Faker\Provider\zh_CN; | ||
|
||
class Color extends \Faker\Provider\Color | ||
{ | ||
/** | ||
* @link https://zh.wikipedia.org/zh-cn/%E9%A2%9C%E8%89%B2%E5%88%97%E8%A1%A8 | ||
*/ | ||
protected static $safeColorNames = array( | ||
'黑色', '粟色', '绿色', '藏青', '橄榄色', | ||
'紫', '凫绿', '鲜绿色', '蓝色', '银色', | ||
'灰色', '黄色', '品红', '水色', '白色' | ||
); | ||
|
||
protected static $allColorNames = array( | ||
'黑色', '昏灰', '灰色', '暗灰', '银色', '亮灰色', | ||
'庚斯博罗灰', '白烟色', '白色', '雪色', '铁灰色', | ||
'沙棕', '玫瑰褐', '亮珊瑚色', '印度红', '褐色', | ||
'耐火砖红', '栗色', '暗红', '鲜红', '红色', '柿子橙', | ||
'雾玫瑰色', '鲑红', '腥红', '蕃茄红', '暗鲑红', | ||
'珊瑚红', '橙红', '亮鲑红', '朱红', '赭黄', '热带橙', | ||
'驼色', '杏黄', '椰褐', '海贝色', '鞍褐', '巧克力色', | ||
'燃橙', '阳橙', '粉扑桃色', '沙褐', '古铜色', '亚麻色', | ||
'蜜橙', '秘鲁色', '乌贼墨色', '赭色', '陶坯黄', '橘色', | ||
'暗橙', '古董白', '日晒色', '硬木色', '杏仁白', | ||
'那瓦霍白', '万寿菊黄', '蕃木瓜色', '灰土色', | ||
'卡其色', '鹿皮鞋色', '旧蕾丝色', '小麦色', '桃色', | ||
'橙色', '花卉白', '金菊色', '暗金菊色', '咖啡色', | ||
'茉莉黄', '琥珀色', '玉米丝色', '铬黄', '金色', | ||
'柠檬绸色', '亮卡其色', '灰金菊色', '暗卡其色', | ||
'含羞草黄', '奶油色', '象牙色', '米黄色', '亮黄', | ||
'亮金菊黄', '香槟黄', '芥末黄', '月黄', '橄榄色', | ||
'鲜黄', '黄色', '苔藓绿', '亮柠檬绿', '橄榄军服绿', | ||
'黄绿', '暗橄榄绿', '苹果绿', '绿黄', '草绿', '草坪绿', | ||
'查特酒绿', '叶绿', '嫩绿', '明绿', '钴绿', '蜜瓜绿', | ||
'暗海绿', '亮绿', '灰绿', '常春藤绿', '森林绿', | ||
'柠檬绿', '暗绿', '绿色', '鲜绿色', '孔雀石绿', | ||
'薄荷绿', '青瓷绿', '碧绿', '绿松石绿', '铬绿', '苍色', | ||
'海绿', '中海绿', '薄荷奶油色', '春绿', '孔雀绿', | ||
'中春绿色', '中碧蓝色', '碧蓝色', '青蓝', '水蓝', | ||
'绿松石蓝', '绿松石色', '亮海绿', '中绿松石色', | ||
'亮青', '浅蓝', '灰绿松石色', '暗岩灰', '凫绿', '暗青', | ||
'青色', '水色', '暗绿松石色', '军服蓝', '孔雀蓝', | ||
'婴儿粉蓝', '浓蓝', '亮蓝', '灰蓝', '萨克斯蓝', | ||
'深天蓝', '天蓝', '亮天蓝', '水手蓝', '普鲁士蓝', | ||
'钢青色', '爱丽丝蓝', '岩灰', '亮岩灰', '道奇蓝', | ||
'矿蓝', '湛蓝', '韦奇伍德瓷蓝', '亮钢蓝', '钴蓝', | ||
'灰丁宁蓝', '矢车菊蓝', '鼠尾草蓝', '暗婴儿粉蓝', | ||
'蓝宝石色', '国际奇连蓝', '蔚蓝', '品蓝', '暗矿蓝', | ||
'极浓海蓝', '天青石蓝', '幽灵白', '薰衣草紫', | ||
'长春花色', '午夜蓝', '藏青', '暗蓝', '中蓝', '蓝色', | ||
'紫藤色', '暗岩蓝', '岩蓝', '中岩蓝', '木槿紫', | ||
'紫丁香色', '中紫红', '紫水晶色', '浅灰紫红', | ||
'缬草紫', '矿紫', '蓝紫', '紫罗兰色', '靛色', '暗兰紫', | ||
'暗紫', '三色堇紫', '锦葵紫', '优品紫红', '中兰紫', | ||
'淡紫丁香色', '蓟紫', '铁线莲紫', '梅红色', '亮紫', | ||
'紫色', '暗洋红', '洋红', '品红', '兰紫', '浅珍珠红', | ||
'陈玫红', '浅玫瑰红', '中青紫红', '洋玫瑰红', | ||
'玫瑰红', '红宝石色', '山茶红', '深粉红', '火鹤红', | ||
'浅珊瑚红', '暖粉红', '勃根第酒红', '尖晶石红', | ||
'胭脂红', '浅粉红', '枢机红', '薰衣草紫红', '灰紫红', | ||
'樱桃红', '浅鲑红', '绯红', '粉红', '亮粉红', '壳黄红', | ||
'茜红', | ||
); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Faker\Provider\zh_CN; | ||
|
||
class DateTime extends \Faker\Provider\DateTime | ||
{ | ||
public static function amPm($max = 'now') | ||
{ | ||
return static::dateTime($max)->format('a') === 'am' ? '上午' : '下午'; | ||
} | ||
|
||
public static function dayOfWeek($max = 'now') | ||
{ | ||
$map = array( | ||
'Sunday' => '星期日', | ||
'Monday' => '星期一', | ||
'Tuesday' => '星期二', | ||
'Wednesday' => '星期三', | ||
'Thursday' => '星期四', | ||
'Friday' => '星期五', | ||
'Saturday' => '星期六', | ||
); | ||
$week = static::dateTime($max)->format('l'); | ||
return isset($map[$week]) ? $map[$week] : $week; | ||
} | ||
|
||
public static function monthName($max = 'now') | ||
{ | ||
$map = array( | ||
'January' => '一月', | ||
'February' => '二月', | ||
'March' => '三月', | ||
'April' => '四月', | ||
'May' => '五月', | ||
'June' => '六月', | ||
'July' => '七月', | ||
'August' => '八月', | ||
'September' => '九月', | ||
'October' => '十月', | ||
'November' => '十一月', | ||
'December' => '十二月', | ||
); | ||
$month = static::dateTime($max)->format('F'); | ||
return isset($map[$month]) ? $map[$month] : $month; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Faker\Provider\zh_CN; | ||
|
||
class Payment extends \Faker\Provider\Payment | ||
{ | ||
/** | ||
* @see https://zh.wikipedia.org/wiki/%E4%B8%AD%E5%9B%BD%E9%93%B6%E8%A1%8C%E5%88%97%E8%A1%A8 | ||
* @var array | ||
*/ | ||
protected static $banks = array( | ||
'渤海银行', | ||
'广发银行', | ||
'国家开发银行', | ||
'恒丰银行', | ||
'华夏银行', | ||
'交通银行', | ||
'平安银行', | ||
'上海浦东发展银行', | ||
'兴业银行', | ||
'招商银行', | ||
'浙商银行', | ||
'中国工商银行', | ||
'中国光大银行', | ||
'中国建设银行', | ||
'中国民生银行', | ||
'中国农业银行', | ||
'中国银行', | ||
'中国邮政储蓄银行', | ||
'中信银行', | ||
); | ||
|
||
/** | ||
* @example '中国建设银行' | ||
* @return string | ||
*/ | ||
public static function bank() | ||
{ | ||
return static::randomElement(static::$banks); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you mention this formatter in the locale-specific section of the Readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)