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: Allow keyboard search to be localized 📡 #500

Closed
wants to merge 9 commits into from

Conversation

darcywong00
Copy link
Contributor

@darcywong00 darcywong00 commented Nov 13, 2024

For starting #384 in localizing the keyboard search page.
(Results come back from api.keyman.com and currently not localized)

  1. The Dockerfile image has updates to install an n_US.UTF-8 locale. Rather than installing more locales, we'll stick with one and use textdomain() to specify the localized files.

  2. Strings contained in .po files and get compiled into .mo files during the ./build.sh start step. All the .po files need to the in /_includes/locale/en/LC_MESSAGE/

  3. Add _s() wrapper so we can do formatted strings with _() - the PHP alias to gettext()

  4. For now, setup the strings on crowdin at
    https://crowdin.com/project/keymancom

  • Will move to LTOPs later.

Usage

For now, the strings can be accessed by adding a parameter e.g.
http://keyman.com.localhost/keyboards/?locale=fr-FR
image

http://keyman.com.localhost/keyboards?locale=es-ES
image

@darcywong00 darcywong00 added this to the A18S15 milestone Nov 13, 2024
'en' => 'English', // Default
'es-ES' => 'Española',
'fr-FR' => 'Français'
];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently not used. Maybe when we settle on UX for specifying UI locale on the site...

<?php if($embed == 'none') echo 'autofocus'; ?>>
<input id="search-f" type="image" src="<?= cdn('img/search-button.png"') ?>" value="Search" onclick="return do_search()">
<label id="search-new"><a href='/keyboards<?=$session_query_q?>'>New search</a></label>
<input id="search-f" type="image" src="<?= cdn('img/search-button.png"') ?>" value="<?= _("Search") ?>" onclick="return do_search()">
Copy link
Contributor Author

@darcywong00 darcywong00 Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The screenshots show the search button still in English -
It's because we're using a static image
https://github.com/keymanapp/keyman.com/blob/master/cdn/dev/img/search-button.png

Maybe the value doesn't even get used...
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image#value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could convert to a label, if someone can provide some CSS-fu styling

<label id="search-f" class="keyboard_search_button" alt="search button" onclick="return do_search()"> <?= _("Search") ?> </label>

@darcywong00 darcywong00 modified the milestones: A18S15, A18S16 Nov 24, 2024
@darcywong00 darcywong00 requested a review from mcdurdin November 29, 2024 03:54
@darcywong00
Copy link
Contributor Author

Pausing on this after 🦆 with @mcdurdin about the PHP plumbing of localization files/configuration

@darcywong00 darcywong00 marked this pull request as draft December 2, 2024 08:26
@darcywong00 darcywong00 modified the milestones: A18S16, A18S17 Dec 7, 2024
@darcywong00 darcywong00 modified the milestones: A18S17, A18S18 Dec 21, 2024
@darcywong00 darcywong00 modified the milestones: A18S18, A18S19 Jan 6, 2025
@darcywong00
Copy link
Contributor Author

Abandoning this PR in favor of #521 onward

@darcywong00 darcywong00 closed this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant