-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
'en' => 'English', // Default | ||
'es-ES' => 'Española', | ||
'fr-FR' => 'Français' | ||
]; |
There was a problem hiding this comment.
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()"> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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>
Pausing on this after 🦆 with @mcdurdin about the PHP plumbing of localization files/configuration |
Abandoning this PR in favor of #521 onward |
For starting #384 in localizing the keyboard search page.
(Results come back from api.keyman.com and currently not localized)
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.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/
Add
_s()
wrapper so we can do formatted strings with_()
- the PHP alias togettext()
For now, setup the strings on crowdin at
https://crowdin.com/project/keymancom
Usage
For now, the strings can be accessed by adding a parameter e.g.
http://keyman.com.localhost/keyboards/?locale=fr-FR
http://keyman.com.localhost/keyboards?locale=es-ES