From eeb35bf4891a1894b75fc233609c4398800cb095 Mon Sep 17 00:00:00 2001 From: adueck Date: Thu, 19 Jan 2023 22:22:37 +0500 Subject: [PATCH] with all words thing --- functions/src/publish.ts | 10 ++++++++-- website/src/screens/ScriptToPhonetics.tsx | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/functions/src/publish.ts b/functions/src/publish.ts index 5b4c32b..3432d59 100644 --- a/functions/src/publish.ts +++ b/functions/src/publish.ts @@ -30,6 +30,7 @@ const dictionaryFilename = "dict"; const dictionaryInfoFilename = "dict-info"; const hunspellAffFileFilename = "ps_AFF.aff"; const hunspellDicFileFilename = "ps_AFF.dic"; +const allWordsJsonFilename = "all-words.json"; const url = `${baseUrl}${dictionaryFilename}`; const infoUrl = `${baseUrl}${dictionaryInfoFilename}`; @@ -60,20 +61,21 @@ export default async function publish(): Promise { } uploadDictionaryToStorage(dictionary).catch(console.error); // TODO: make this async and run after publish response - doHunspell(entries).catch(console.error); + doHunspellEtc(entries).catch(console.error); return { ok: true, info: dictionary.info }; } -async function doHunspell(entries: T.DictionaryEntry[]) { +async function doHunspellEtc(entries: T.DictionaryEntry[]) { const wordlistResponse = getWordList(entries); if (!wordlistResponse.ok) { throw new Error(JSON.stringify(wordlistResponse.errors)); } const hunspell = makeHunspell(wordlistResponse.wordlist); await uploadHunspellToStorage(hunspell); + await uploadAllWordsToStoarage(wordlistResponse.wordlist) } /** @@ -232,6 +234,10 @@ async function uploadHunspellToStorage(wordlist: { ]); } +async function uploadAllWordsToStoarage(words: string[]) { + await upload(JSON.stringify({words}), allWordsJsonFilename) +} + async function uploadDictionaryToStorage(dictionary: T.Dictionary) { const dictionaryBuffer = writeDictionary(dictionary); const dictionaryInfoBuffer = writeDictionaryInfo(dictionary.info); diff --git a/website/src/screens/ScriptToPhonetics.tsx b/website/src/screens/ScriptToPhonetics.tsx index edd8032..1c676d5 100644 --- a/website/src/screens/ScriptToPhonetics.tsx +++ b/website/src/screens/ScriptToPhonetics.tsx @@ -44,6 +44,7 @@ const ScriptToPhonetics = () => { rows={4} value={text} onChange={e => setText(e.target.value)} + dir="rtl" />