Skip to content

Commit

Permalink
upgrade emojis to version 15
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Aug 23, 2024
1 parent 5b741c2 commit 2ef5795
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 394,425 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ dev:
build:
npm run tauri build

i18n:
translate:
git -C "cldr-json" pull || git clone https://github.com/unicode-org/cldr-json.git "cldr-json"
git -C "emoji-mart" pull || git clone https://github.com/missive/emoji-mart.git "emoji-mart"
node resources/internationalize.js
node resources/internationalize.js $(version)

bump:
sed -i "s/\"version\": \"[0-9]*\.[0-9]*\.[0-9]*\",/\"version\": \"$(version)\",/g" ./package.json
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ To automatically upgrade dependencies with `yarn` and `cargo` you can run:
make upgrade
```

Generate translated description in 22 languages for all emojis of a certain [version](https://github.com/missive/emoji-mart/tree/main/packages/emoji-mart-data/sets):

```bash
make translate version=15
```

### 🏷️ New release

To publish a new release, follow this process:
Expand Down
12 changes: 7 additions & 5 deletions resources/internationalize.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { readFileSync, readdirSync, writeFileSync } from 'fs'

const emojiVersion = process.argv[2] || "15";

console.log(`🚀 Generating translations for emojis version ${emojiVersion}`)

// ️Variation Selector-16
const VS16 = '\ufe0f'
// Zero Width Joiner
Expand All @@ -14,7 +18,7 @@ const capitalize = ['fr', 'es', 'de', 'cs', 'nl']
async function main() {
// Read emoji-mart data
let martData = JSON.parse(
readFileSync('emoji-mart/packages/emoji-mart-data/sets/14/native.json', 'utf-8')
readFileSync(`emoji-mart/packages/emoji-mart-data/sets/${emojiVersion}/native.json`, 'utf-8')
)
// const martData = await (await fetch(`https://raw.github.com/missive/emoji-mart/main/packages/emoji-mart-data/sets/14/native.json`)).json()

Expand All @@ -25,9 +29,7 @@ async function main() {
})

for (let lang of langs) {
// Fix for korean lang not properly defined in emoji-mart
if (lang == 'kr') lang = 'ko'
console.log(`🏳️ Generating translation for ${lang}`)
console.log(`✔️ Translating to ${lang}`)
try {
// Read CLDR data: git clone https://github.com/unicode-org/cldr-json
const langFull = JSON.parse(
Expand Down Expand Up @@ -74,7 +76,7 @@ async function main() {
// Write localized data
writeFileSync(`${targetFolder}/${lang}.json`, JSON.stringify(martData))
} catch (_err) {
console.error(`⚠️ Could not find cldr language file for ${lang}`)
console.warn(`⚠️ Could not find cldr language file for ${lang}`)
}
}
}
Expand Down
Loading

0 comments on commit 2ef5795

Please sign in to comment.