Skip to content

Added korean support and i18n framework#42

Open
minuscholastica wants to merge 5 commits intohrishioa:masterfrom
minuscholastica:add-korean-translation
Open

Added korean support and i18n framework#42
minuscholastica wants to merge 5 commits intohrishioa:masterfrom
minuscholastica:add-korean-translation

Conversation

@minuscholastica
Copy link
Copy Markdown

@minuscholastica minuscholastica commented Aug 30, 2024

Lumentis Goes Bilingual and maybe Multilingual

Annyeonghaseyo, Lumentis! 🇰🇷

This PR adds internationalization (i18n) to Lumentis, adding support for Korean language alongside English!

Summary of Changes

  1. Implemented i18next for internationalization:
  • i18next configuration in app.ts
  1. Updated user-facing strings:
  • Replaced hardcoded English strings with calls to the translation function t()
  • This way, all prompts and messages are mapped to the translation function
  1. Created translation files:
  • Added src/locales/en/translation.json for English
  • Added src/locales/ko/translation.json for Korean
  1. Modified app.ts to support language selection:
  • Added a language selection prompt at the start of the wizard
  • Implemented language switching using i18next

Overall:

  • Users can now choose between English and Korean at the start of the wizard
  • All subsequent prompts and messages will be displayed in the chosen language
  • The change is backwards compatible; English remains the default language
  • No changes to the core functionality of Lumentis; only the user interface is affected

Testing

  1. Tested:
  • Tested the wizard flow in both English and Korean
  • Verified that all major translated strings are displayed correctly
  • Ensured that the language selection does not interfere with the existing workflow
  1. To test this PR:
  • Install the new dependencies: npm install i18next i18next-fs-backend
  • Run lumentis
  • Select a language when prompted: English or 한국어 (Korean)
  • Proceed through the wizard, verifying that all text is in the chosen language

Further Language Support

For other languages:

  1. Created the translated script following the format of src/locales/en/translation.json
  2. Create a folder under src/locales/[abbreviated language code]
  3. Adjust the app.ts accordingly

What Still Needs to be Added

  1. Korean font: Right now, Korean words are displayed a bit unnaturally because there's a lot more gap between character. Seeing if this can be improved by adding a font directly to the repo.
  2. Not all messages are in Korean: Some messages that are not coming from app.ts are not translated to Korean.
  • Example: (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
  1. Adjust the structure of app.ts to easily support adding additional languages

@minuscholastica minuscholastica changed the title Lumentis Goes Bilingual and maybe Multilingual: Adding Korean Support and i18n Framework Added korean support and i18n framework Aug 30, 2024
@HebeHH HebeHH requested a review from hrishioa August 30, 2024 18:04
@hrishioa
Copy link
Copy Markdown
Owner

@minuscholastica haha seems you accidentally checked in your wizard.json. I'd delete this PR and repush?

@HebeHH
Copy link
Copy Markdown
Collaborator

HebeHH commented Aug 30, 2024

@hrishioa didn't you have an issue discussion about how .lumentis shouldn't be gitignored?

Also pls review we will just delete the wizard.json file, not worried about existence in history.

@hrishioa
Copy link
Copy Markdown
Owner

"we"

.lumentis I meant for generated projects haha not lumentis itself

but yes will review :D

@HebeHH
Copy link
Copy Markdown
Collaborator

HebeHH commented Aug 30, 2024

Have not properly tested the korean prompt injection btw, trying to do that now

@HebeHH
Copy link
Copy Markdown
Collaborator

HebeHH commented Aug 30, 2024

Tested successfully!

image

Callouts, steps, and even mermaid diagrams are working properly:

image

The JSON is also coming through properly. This means that the field names are coming through in english (needed to identify in code), but the text is coming through in Korean. This is especially clear in the outline:

image

In other words, from testing the prompts are successfully ensuring that the user text will be given in Korean, while the identifiers and formatting are in English as required for processing.

Leaving it to @minuscholastica to create a demo Vercel website to illustrate the success of this, and give a review on Claude's Korean writing abilities.

(to run in dev: clone/pull repo. Create a new folder at the same level. cd to folder. Run bun ../lumentis/src/app.ts)
(your folder structure should look like this:

> lumentisArea
--> myDocsFolder
--> lumentis
----> src
--------app.ts

Go to myDocsFolder in console and run bun ../lumentis/src/app.ts to test. Then once you've generated a website, share via Vercel~
)

@HebeHH
Copy link
Copy Markdown
Collaborator

HebeHH commented Aug 30, 2024

Next steps: get the user to type their language in, if not provided. Call the AI to translate the questions into given language.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants