8000 feature #46755 [Intl] Add `EmojiTransliterator` to translate emoji to… · symfony/symfony@41dfb72 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41dfb72

Browse files
feature #46755 [Intl] Add EmojiTransliterator to translate emoji to many locales (lyrixx, nicolas-grekas)
This PR was merged into the 6.2 branch. Discussion ---------- [Intl] Add `EmojiTransliterator` to translate emoji to many locales | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | Today, I used the AsciiSlugger and I was really surprised that it replaced my emoji with nothing (a blank string). I dig a bit, and I think the best way to solve that is to add a EmojiTransliterator, and then wire it (another PR) Current API: ```php $tr = EmojiTransliterator::getInstance('en'); $tr->transliterate('a 😺, 🐈‍⬛, and a 🦁 go to 🏞️... 😍 🎉 💛'); // a grinning cat, black cat, and a lion go to national park️... smiling face with heart-eyes party popper yellow heart ``` --- To do that, I built some transliterator rules, and I committed them to the repository. The sources come from the official data at https://github.com/unicode-org/cldr Commits ------- 55d57ff Use PHP for emoji maps 97ea933 [Intl] Add EmojiTransliterator to translate emoji to many locales
2 parents b1b77f3 + 55d57ff commit 41dfb72

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+429582
-3
lines changed

.github/workflows/package-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Find packages
2323
id: find-packages
24-
run: echo "::set-output name=packages::$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))"
24+
run: echo "::set-output name=packages::$(php .github/get-modified-packages.php $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Intl/Resources/emoji |jq -R -s -c 'split("\n")[:-1]') $(git diff --name-only origin/${{ github.base_ref }} HEAD | grep src/ | jq -R -s -c 'split("\n")[:-1]'))"
2525

2626
- name: Verify meta files are correct
2727
run: |

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV
9999
cp composer.json composer.json.orig
100100
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json
101-
php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n')
101+
php .github/build-packages.php HEAD^ $SYMFONY_VERSION $(find src/Symfony -mindepth 2 -type f -name composer.json -printf '%h\n' | grep -v src/Symfony/Component/Intl/Resources/emoji)
102102
mv composer.json composer.json.phpunit
103103
mv composer.json.orig composer.json
104104
fi

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<directory name="src/Symfony/*/*/Tests" />
1515
<directory name="src/Symfony/*/*/*/Tests" />
1616
<directory name="src/Symfony/*/*/*/*/Tests" />
17+
<directory name="src/Symfony/Component/Intl/Resources/emoji/" />
1718
<directory name="vendor" />
1819
</ignoreFiles>
1920
</projectFiles>

src/Symfony/Component/Intl/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/phpunit.xml.dist export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5+
/Resources/emoji export-ignore

src/Symfony/Component/Intl/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.2
5+
---
6+
7+
* Add `EmojiTransliterator` to translate emoji to many locales
8+
49
6.0
510
---
611

src/Symfony/Component/Intl/Resources/data/transliterator/emoji/af.php

Lines changed: 3623 additions & 0 deletions
Large diffs are not rendered by default.

src/Symfony/Component/Intl/Resources/data/transliterator/emoji/am.php

Lines changed: 3623 additions & 0 deletions
Large diffs are not rendered by default.

src/Symfony/Component/Intl/Resources/data/transliterator/emoji/ar.php

Lines changed: 3623 additions & 0 deletions
Large diffs are not rendered by default.

src/Symfony/Component/Intl/Resources/data/transliterator/emoji/ar_sa.php

Lines changed: 1362 additions & 0 deletions
Large diffs are not rendered by default.

src/Symfony/Component/Intl/Resources/data/transliterator/emoji/as.php

Lines changed: 3623 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
0