Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Localize keyboard search page #384

Open
darcywong00 opened this issue Sep 18, 2023 · 4 comments
Open

feat: Localize keyboard search page #384

darcywong00 opened this issue Sep 18, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@darcywong00
Copy link
Contributor

From the Sept 2023 team planning meetings M4 review of websites

While we would like to localize all the websites, it's too much content (keyman and help.keyman), so the immediate priority is the keyboard search page.

  • Get the keyboard search strings into Crowdin (may need to be separate from the Keyman project due to syncing
  • Have a way for user to select locale
@darcywong00 darcywong00 added the enhancement New feature or request label Sep 18, 2023
@mcdurdin mcdurdin added this to the 18.0 milestone Sep 18, 2023
@mcdurdin mcdurdin modified the milestones: 18.0, A18S11 Apr 29, 2024
@darcywong00 darcywong00 modified the milestones: A18S11, A18S12 Sep 28, 2024
@darcywong00 darcywong00 modified the milestones: A18S12, A18S13 Oct 11, 2024
@darcywong00 darcywong00 modified the milestones: A18S13, A18S14 Oct 26, 2024
@darcywong00
Copy link
Contributor Author

Possibly use docusaurus along with crowdin...

@darcywong00
Copy link
Contributor Author

darcywong00 commented Nov 7, 2024

nogo with docusaurus since it needs a static Markdown-generated site.

gettext

Now exploring Gettext CakePHP and .po files

Example
https://www.codeandweb.com/babeledit/tutorials/translation-with-gettext-and-php

Pros:
"Easy" to setup and generate po files

Cons:
Server has to install each locale (Docker image needs to add each locale and they're limited to xx_YY in /etc/locale.gen)

Setup:

  1. In /_includes/includes/, create the folder <language>_<region>/LC_MESSAGES/
  2. Copy a .po file into this new folder and translate / upload to crowdin
  3. Convert .po file to .mo
msgfmt messages.po --output-file=messages.mo
  1. Update Dockerfile image to include locale (involves uncommenting a locale in /etc/locale.gen)

@darcywong00
Copy link
Contributor Author

For adding formatted strings with gettext
https://stackoverflow.com/a/16922727/1836776

Maybe add a wrapper
_s("welcome_string", $user_name) where welcome_string == "Hello %1$s" in the .po

so for the .po, we'd have:

# Welcome string for site visitors
#  parameter 1: string, name of site visitor
msgid "welcome_string"
msgstr "Hi there %1$s!"

And _s would be something like

function _s($s, ...) {
  return sprintf(_($s), ...);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants