Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Add Chinese Simplified (zh-CN) Lorem and Text provider #1376

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

ganlvtech
Copy link

No description provided.

readme.md Outdated Show resolved Hide resolved
src/Faker/Provider/zh_CN/Text.php Outdated Show resolved Hide resolved
@ganlvtech
Copy link
Author

Lorem has moved to another repo https://github.com/ganlvtech/faker-chinese-lorem .
even after reading #1011 , I still don't know how to provide a Lorem provider gracefully.

The base text was written in 1926, and the previous link was wrong by my mistake. I have fixed it. Now, it reference to a correct location.

readme.md Outdated Show resolved Hide resolved
src/Faker/Provider/zh_CN/Text.php Outdated Show resolved Hide resolved
"Text::utf8_strlen" is not in camel caps format
"Text::utf8_chars" is not in camel caps format
@ganlvtech
Copy link
Author

ganlvtech commented Oct 4, 2018

  • Readme changed.
  • Text long enough.
  • No lorem provider.
  • Test case added.

@ganlvtech ganlvtech changed the title Add Chinese (simplified) Lorem and Text provider Add Chinese Simplified (zh-CN) Lorem and Text provider Nov 24, 2018
/**
* Get UTF-8 string characters array
*
* TODO: this function is not used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this method in here when it is not used? And in general speaking i dont think such a method even belongs in a locale. If it belongs somewhere then it would even be in the core itself

Copy link
Author

@ganlvtech ganlvtech Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function utf8Chars is a fallback for explode. I don't know if preg_split with /u works well for utf8 text. So I provide a fallback function. But it's actually not used.

*
* @return int
*/
protected static function utf8Strlen($text)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wont the php native mb functions handle this properly nowadays?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to change all this messy code to mb_* function. But there is no ext_mbstring in package.json. So I don't use these functions.

@ganlvtech
Copy link
Author

@pimjansen What do think about adding ext-mbstring to package.json

@pimjansen
Copy link
Contributor

@ganlvtech not a fan of this since it would mean a breaking change. We are not allowing it till we start with Faker 2.0 later this year.

So for 1.x we cant

@singleseeker
Copy link

Any update?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants