diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.js b/app/javascript/mastodon/features/ui/components/focal_point_modal.js index 7d1509f71..d5a74d1ce 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.js +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.js @@ -224,11 +224,15 @@ class FocalPointModal extends ImmutablePureComponent { } } - worker.recognize(media_url) - .progress(({ progress }) => this.setState({ progress })) - .finally(() => worker.terminate()) - .then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false })) - .catch(() => this.setState({ detecting: false })); + (async () => { + await worker.loadLanguage('eng+chi_sim+chi_sim_vert+chi_tra+chi_tra_vert'); + await worker.initialize('eng+chi_sim+chi_tra'); + worker.recognize(media_url) + .progress(({ progress }) => this.setState({ progress })) + .finally(() => worker.terminate()) + .then(({ text }) => this.setState({ description: removeExtraLineBreaks(text), dirty: true, detecting: false })) + .catch(() => this.setState({ detecting: false })); + })(); }).catch(() => this.setState({ detecting: false })); } diff --git a/public/ocr/lang-data/chi_sim.traineddata.gz b/public/ocr/lang-data/chi_sim.traineddata.gz new file mode 100644 index 000000000..ed6d91a34 Binary files /dev/null and b/public/ocr/lang-data/chi_sim.traineddata.gz differ diff --git a/public/ocr/lang-data/chi_sim_vert.traineddata.gz b/public/ocr/lang-data/chi_sim_vert.traineddata.gz new file mode 100644 index 000000000..2b3c15d46 Binary files /dev/null and b/public/ocr/lang-data/chi_sim_vert.traineddata.gz differ diff --git a/public/ocr/lang-data/chi_tra.traineddata.gz b/public/ocr/lang-data/chi_tra.traineddata.gz new file mode 100644 index 000000000..d55273cdd Binary files /dev/null and b/public/ocr/lang-data/chi_tra.traineddata.gz differ diff --git a/public/ocr/lang-data/chi_tra_vert.traineddata.gz b/public/ocr/lang-data/chi_tra_vert.traineddata.gz new file mode 100644 index 000000000..ed3eda38d Binary files /dev/null and b/public/ocr/lang-data/chi_tra_vert.traineddata.gz differ