feat: quotation marks localization (@anakojm)#8074
Conversation
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
|
If we want to support this, we should add the quotation marks inside the language files and not add a huge if/else |
|
you’re right, that would be cleaner. i will try to do that. i just kinda took how it was implemented already to the extreme |
|
@fehmer sorry, i am not familiar with this codebase. how should i access the key—say |
|
another possibility that introduces less changes and is more lightweight, is to only keep the changes to frontend/src/ts/utils/strings.ts. all the other changes are purely cosmetic, and might actually clash in some cases with pre‐existing non‐use of typographical characters ( |
--- a/frontend/src/ts/test/words-generator.ts
+++ b/frontend/src/ts/test/words-generator.ts
@@ -42,6 +42,7 @@ export async function punctuateWord(
currentWord: string,
index: number,
maxindex: number,
+ language:LanguageObject,
): Promise<string> {
let word = currentWord;
@@ -1132,6 +1133,7 @@ export async function getNextWord(
randomWord,
wordIndex,
wordsBound,
+ currentLanguage
);
}you can just pass it in as a new parameter like this. |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
Co-authored-by: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com>
|
hi @anakojm , one last comment, the rest looks fine, thanks |
Description
this PR introduces localization for quotation marks in most languages. the data is from wikipedia
primary punctuation symbols
languages that use two or more
secondary punctuation symbols
languages that use two or more
i do not know how to implement these so i did not. one of the two options coud be arbitrarily chosen, and the ability to set custom quotation marks added, but this out of the scope of this PR
languages not in monkeytype
format:
language exists, but alternate script does not
language exists, but alternate typographical convention does not
there exists one language where there are toggle able alternate typographical conventions: English (“british english”). i believe the same thing could be done for Portuguese, Korean, and perhaps with French & French Swiss and Italian & Italian Swiss and others, but this is out of the scope of this PR
languages in monkeytype, and not in the wikipedia data
currently we fall back to the default ("…", '…') for these, as for “gimmick” languages (leagues of legend, pokemon, typing of the dead…)
note that because of the changes in
frontend/src/ts/utils/strings.ts, all of these changes are purely visual, and a user can input any quote mark they want, given it corresponds to the correct level of quotation.note that wikipedia uses the term “Slovene”, instead of the term used by monkeytype “Slovenian”, but this probably doesn’t matter
also note that Hungarian has a third level of quotes: ’…’. Portuguese (Portugal) also has: ‘…’
Checks