Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[String] Transliterate & to and#35689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromWarxcell:patch-3
Feb 13, 2020
Merged

[String] Transliterate & to and#35689

fabpot merged 1 commit intosymfony:masterfromWarxcell:patch-3
Feb 13, 2020

Conversation

Warxcell
Copy link
Contributor

QA
Branch?5.0
Bug fix?kind of
New feature?no
Deprecations?no
Tickets
LicenseMIT
Doc PR

@nicolas-grekas
Copy link
Member

Can you please add a test case?

Warxcell reacted with thumbs up emoji

@Warxcell
Copy link
ContributorAuthor

@nicolas-grekas I think it's also a good idea to be able to add custom behaviour in that slugger (for such replacements). I was thinking about callback. What do you think?

@nicolas-grekasnicolas-grekas changed the titleTransliterate & to and[String] Transliterate & to andFeb 13, 2020
@nicolas-grekas
Copy link
Member

be able to add custom behaviour in that slugger

I don't think it's needed: decoration alreadt allows implementing custom behaviors to me.

@fabpotfabpot changed the base branch from5.0 tomasterFebruary 13, 2020 15:03
@fabpot
Copy link
Member

Thank you@Warxcell.

fabpot added a commit that referenced this pull requestFeb 13, 2020
This PR was submitted for the 5.0 branch but it was squashed and merged into the 5.1-dev branch instead.Discussion----------[String] Transliterate & to and| Q             | A| ------------- | ---| Branch?       | 5.0| Bug fix?      | kind of| New feature?  | no| Deprecations? | no| Tickets       || License       | MIT| Doc PR        |Commits-------76ff984 [String] Transliterate & to and
@fabpotfabpot merged commit76ff984 intosymfony:masterFeb 13, 2020
@Warxcell
Copy link
ContributorAuthor

@nicolas-grekas kinda. You have to make your own instance ofUnicodeString beforeAsciiSlugger,
then pass result from->toString() toAsciiSlugger. Or just use regularstr_* ormb_* functions.

    public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString    {        $string = new UnicodeString($string);        $string->replace('XX', 'YY');        //  do other stuffs        return $this->asciiSlugger->slug($string->toString(), $separator, $locale);    }

@nicolas-grekas
Copy link
Member

yes
or you replace on the return point (return parent::slug(...)->replace(...);)
or you reimplement completely
etc

@Warxcell
Copy link
ContributorAuthor

Warxcell commentedFeb 13, 2020
edited
Loading

@nicolas-grekas no, not exactly. on return point everything is now replaced by $separator - it's too late to do anything else on this string.
The other possibility is method to accept either string, eitherAbstractUnicodeString.

@nicolas-grekas
Copy link
Member

Oh, indeed. Thestring barrier is not an issue to me, it's fine creating the object again inside.

Warxcell reacted with thumbs up emoji

@fabpotfabpot mentioned this pull requestMay 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@Warxcell@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp