Skip to content

feat: quotation marks localization (@anakojm)#8074

Open
anakojm wants to merge 14 commits into
monkeytypegame:masterfrom
anakojm:quotation-marks
Open

feat: quotation marks localization (@anakojm)#8074
anakojm wants to merge 14 commits into
monkeytypegame:masterfrom
anakojm:quotation-marks

Conversation

@anakojm

@anakojm anakojm commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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

  • Bosnian: ”…” and „…”
  • Danish: »…« and „…“
  • Latvian: “…” and „…”
  • toki pona: any/none

secondary punctuation symbols

languages that use two or more

  • Danish: ›…‹ and ‚…‘
  • French: «…» and “…”
  • Greek: “…” and ‟…”
  • Icelandic: ‚…‘ and ‘…’
  • Ukrainian: “…” and „…“
  • toki pona: any/none

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: primary, secondary

  • Basque: «…», “…”
  • French Swiss: «…», ‹…›
  • Ido: «…», ‘…’
  • Interlingua: “…”, ‘…’
  • Italian Swiss: «…», ‹…›
  • Karakalpak: «…», none
  • New Tai Lue: 《…》, ⟨…⟩
  • Romansh: «…», ‹…›
  • Scottish Gaelic: ‘…’, “…”
  • Sorbian: „…”, ‘…’
  • Tai Le: 《…》, ⟨…⟩
  • Tigrinya: «…», ‹…›
  • Uyghur: «…», ‹…›

language exists, but alternate script does not

  • Uzbek (Cyrillic): «…», „…“
  • Mongolian (Mongolian script): ⟪…⟫, ⟨…⟩

language exists, but alternate typographical convention does not

  • Korean (North Korea): 《…》, ⟨…⟩
  • Portuguese (Portugal): «…», “…”

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.

  • Bangla
  • Bashkir
  • Bemba
  • Euskera
  • Frisian
  • Friulian
  • Greeklish
  • Gujarati
  • Hausa
  • Hawaiian
  • Hinglish
  • Jyutping
  • Kabyle
  • Kannada
  • Kinyarwanda
  • Klingon
  • Kokanu
  • Kurdish
  • Kyrgyz
  • Latin
  • Likanu
  • Lorem
  • Malagasy
  • Malay
  • Malayalam
  • Maori
  • Marathi
  • Myanmar
  • Nepali
  • Oromo
  • Pinyin
  • Quenya
  • Sanskrit
  • Santali
  • Shona
  • Sinhala
  • Swahili
  • Tamil
  • Tanglish
  • Tatar
  • Telugu
  • Udmurt
  • Urdish
  • Viossa
  • Xhosa
  • Yiddish
  • Yoruba
  • Zulu

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

  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for update Pull requests or issues that require changes/comments before continuing labels Jun 7, 2026
@fehmer

fehmer commented Jun 7, 2026

Copy link
Copy Markdown
Member

If we want to support this, we should add the quotation marks inside the language files and not add a huge if/else

@anakojm

anakojm commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

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

@anakojm

anakojm commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

@fehmer sorry, i am not familiar with this codebase. how should i access the key—say "quot_marks"—of a language file (ex frontend/static/languages/english.json i assume). i don’t know how to get this data cleanly from the front end

@anakojm

anakojm commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

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 (' instead of for instance). as such they might need their own PR for a “typography mode”. a compromise between these two position is to conserve "/' for languages that use & / & , and only introduce the visual change for languages that use « & » and other visually very different quotation marks

@fehmer

fehmer commented Jun 7, 2026

Copy link
Copy Markdown
Member
--- 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.

@monkeytypegeorge monkeytypegeorge added assets Languages, themes, layouts, etc. packages Changes in local packages labels Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 7, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 7, 2026
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions Bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 7, 2026
@github-actions github-actions Bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Jun 7, 2026
@monkeytypegeorge monkeytypegeorge added the docs Related to Markdown files and documentation label Jun 7, 2026
Comment thread docs/LANGUAGES.md Outdated
anakojm and others added 2 commits June 7, 2026 15:38
Co-authored-by: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com>
@anakojm anakojm requested a review from Leonabcd123 June 7, 2026 20:26
@anakojm anakojm requested a review from fehmer June 7, 2026 20:26
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jun 7, 2026
Comment thread packages/schemas/src/languages.ts
@github-actions github-actions Bot removed the waiting for review Pull requests that require a review before continuing label Jun 7, 2026
@fehmer

fehmer commented Jun 7, 2026

Copy link
Copy Markdown
Member

hi @anakojm , one last comment, the rest looks fine, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assets Languages, themes, layouts, etc. docs Related to Markdown files and documentation frontend User interface or web stuff packages Changes in local packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants