#28577 closed task (blessed) (fixed)
Allow language to be chosen during initial install
Reported by: | nacin | Owned by: | |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | I18N | Keywords: | has-patch |
Focuses: | Cc: |
Description
The first step installing WordPress should be to choose a language. The rest of the install process would then be in that language.
As outlined in http://make.wordpress.org/core/2014/05/21/internationalization-goals-for-4-0/, we'd like something like this:
Multiple workflows
One issue that came up in #26879 (“friendlier welcome when installing WordPress”) is that setup-config.php is often not the initial entry point. A user installing WordPress through a hosting control panel is likely to be dumped onto the install screen (if not the dashboard directly).
Thus, we need to keep in mind that either screen might be the “intro” screen. This introduces technical challenges: If the user’s first step is setup-config.php, we don’t actually have WordPress fully loaded at this point, which makes actually installing a language pack more difficult. The install step has WordPress loaded in full, just without database tables. We should look into making setup-config.php load “all” of WordPress to make these environments easier to code.
How to approach this
There are two different ways to approach this: download language files immediately upon selection, or bundle barebones language files of the install screens for all supported languages. The latter is not the easiest thing to do (due to error messages and such, strings can come from all over) and also adds a delay to the adoption of new languages. The former would mean that we would want to pull a languages list from WordPress.org. (If we cannot reach WordPress.org, we would have no way of downloading the complete language pack, so this is not a big deal.) It’s still a bit of a challenge due to the split workflows problem.
The plan is to download language files immediately upon selection.
Language suggestions
WordPress.org already recommends a language based on the browser’s settings (Accept-Language header) as well as using a more rough lookup based on IP address blocks. (HTML5 location could be used, but unless we’re also going to use that to set the user’s timezone, it seems excessive for a “choose your language” for the moment, especially since location is not as preferred anyway.)
Both would require the client to hit WordPress.org via JavaScript, versus a server HTTP request. We can do a server-side HTTP request to generate the list, then a client-side request to float recommended ones to the top. It’s possible to do it in two steps: the Accept-Language mapping can be done locally, while the IP-to-location table on WordPress.org has 2.9 million entries and would require a round-trip. Of course, if a user has downloaded a localized package directly from a local WordPress.org site, that would be the top recommendation.
Locale variants
Note that by language or locale we also must consider other translation variants, as there may be a language like Portuguese available in multiple locales (Brazil, Portugal) and further broken down by formal and informal variants. Each of these would be listed as their own “language.” c.f. #28303
API
https://api.wordpress.org/translations/core/1.0/?version=4.0-alpha is functional.
Attachments (11)
Change History (79)
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
10 years ago
#4
follow-up:
↓ 5
@
10 years ago
I know it's early days, but this currently causes the "Allow search engines to index this site" checkbox to be unchecked by default because it's sending POST data to install.php without a value for blog_public
.
#5
in reply to:
↑ 4
@
10 years ago
Replying to johnbillion:
I know it's early days, but this currently causes the "Allow search engines to index this site" checkbox to be unchecked by default because it's sending POST data to install.php without a value for
blog_public
.
Great catch, I had definitely missed that. (Doesn't help when the screen was mostly in languages I did not understand during testing.)
#8
follow-ups:
↓ 17
↓ 49
@
10 years ago
- Keywords needs-patch added; has-patch removed
The to-do list here is not short. If you want to help out, there's a list at the bottom. Main things to do: better error & filesystem handling, setup-config.php, locale variants, improved localization, language suggestions. The details:
On errors:
- Before showing the language chooser, pre-flight whether we can actually download and install language files using 'direct' file access. Thinking we ignore FTP?
- Gracefully fail if we failed to install the target language. Right now it'll simply load everything in English and not end up setting WPLANG. While this is graceful, it is also silent. Desired?
On implementation:
- Bring this to setup-config.php somehow. The wp_die() in wp-load.php is troublesome; we'll probably need to come up with an all-new workflow and code flow.
- Locale variants need to be designed and implemented.
On localization:
- Rather than using the native name, use "Use English as the main language" (but translated into the language). This will be translated on translate.wordpress.org but actually served from the API. Also, rather than an arrow, we can use a translation of "Continue" or "Let's go!" or "Get started" (again, served from the API) for the button.
- Certain languages are best displayed in certain ways. We need to investigate these. For example, Hebrew should be in RTL including Arabic should be in Tahoma. Of course, this is pretty easy to configure via the API. Might these need to be also aligned right? There's also a language in central Asia that requires its own typeface, if I recall correctly. We will probably need to abandon this multi-line select box in favor of something more robust in order to improve styling.
The order of language suggestions:
- If we detect a language based on your browser, this should be first. If we detect multiple, we should list them in the order specified.
- If we are able to guess one or more language suggestions based on your IP address, these should come next.
- If you downloaded a particular language's ZIP package, this language should be listed next. (It's possible this should actually be the very first one.)
- English (US) should then be listed.
- All other languages should be listed in some kind of alphabetic order. Currently the API is ordered by ISO per an initial suggestion from Zé (vanillalounge), but this means languages like Spanish (Spain) and Spanish (Chile) are not listed anywhere near each other. We could benefit from some kind of natural sort, even if this is done manually (based on the order from GlotPress, for example).
If you want to help, the best things to help with are:
- The 'errors' stuff, which should be straightforward-ish but will require some familiarity (or desire to gain familiarity) with WP_Upgrader and friends.
- The setup-config.php stuff. This is probably gonna be a sizable refactor; may require a few attempts / false-starts. (Show your work; it helps to see what others have tried.)
- Research how to best display and sort native names. How do others do it? (OS X, Ubuntu, Drupal, Joomla...)
I'll be working on the more complex tasks that require heavy .org integration:
- Suggestions
- Locale variants
- Leveraging string translations via the API
#9
follow-up:
↓ 13
@
10 years ago
What should happen if WPLANG
is already set to a non-default value when running the installer? Should we skip the language selection, or should it still be shown but with that language pre-selected?
Subsequently, will we see issues if the WPLANG
constant is set to one language, but the site gets installed with another so the get_option('WPLANG')
ends up being different? (Thinking of plugins that use WPLANG
directly instead of get_option('WPLANG')
.
#10
follow-up:
↓ 16
@
10 years ago
Here's a dump of screenshots of the language switcher from various installation screens:
Drupal 7.28
Joomla 3.3
RedHat Enterprise 5
Ubuntu Desktop
Windows 7
Windows 8
Windows Essentials
Some Observations
OS X and Windows 7 use a sentence for each language ("Use %s as the main language" and "My language is %s" respectively). All other language selectors I've seen just use the language name on its own. Sometimes this is just the native name, sometimes it's the English name alongside the native name.
A drop down list is not obviously a language selector if you can't read English. A list that's at least partially visible is much more clearly a language switcher.
The Joomla! install process has added complexity because it needs to force a reload of the page if you change language.
The Windows Essentials language switcher splits the list into installed and available languages. Although we should avoid this in WordPress, we could list the currently installed languages (if any) at the top of the list.
Below is a screenshot of the language switcher on Google. It demonstrates how long the list of languages could potentially get. The less common languages are hidden by default behind a 'show more' link.
#11
@
10 years ago
I think we should go with an unordered list containing radio buttons. The list items would float into columns as necessary.
IMHO the English name of a language is not of much use. I think just the native name should be used in the list.
#12
@
10 years ago
We should add a loading spinner next to the submit button on the language selection screen. It could potentially be slow to download translations on a slow connection.
#13
in reply to:
↑ 9
;
follow-up:
↓ 14
@
10 years ago
Replying to johnbillion:
What should happen if
WPLANG
is already set to a non-default value when running the installer? Should we skip the language selection, or should it still be shown but with that language pre-selected?
Shown pre-selected. This is part of the suggestions work.
Subsequently, will we see issues if the
WPLANG
constant is set to one language, but the site gets installed with another so theget_option('WPLANG')
ends up being different? (Thinking of plugins that useWPLANG
directly instead ofget_option('WPLANG')
.
Plugins using should be using get_locale(). Neither of these are valid to use.
#14
in reply to:
↑ 13
@
10 years ago
Replying to nacin:
Replying to johnbillion:
Subsequently, will we see issues if the
WPLANG
constant is set to one language, but the site gets installed with another so theget_option('WPLANG')
ends up being different? (Thinking of plugins that useWPLANG
directly instead ofget_option('WPLANG')
.
Plugins using should be using get_locale(). Neither of these are valid to use.
Unfortunately a grep of the plugin directory shows just over 400 plugins using WPLANG
in one form or another.
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
10 years ago
#16
in reply to:
↑ 10
@
10 years ago
I've worked on some mockups for the language selection screen a while ago: http://make.wordpress.org/core/2014/05/21/internationalization-goals-for-4-0/#comment-15796
Looks like @nacin prefers the translated "Use english as language" phrase rather than just a dropdown of all languages. Which is fine with me, just thought it might be easier to find your language if it's just the name of the language in an alphabetical list. But either approach works.
Are there other screens I can work on, or error states? Let me know.
#17
in reply to:
↑ 8
@
10 years ago
Replying to nacin:
On errors:
- Before showing the language chooser, pre-flight whether we can actually download and install language files using 'direct' file access. Thinking we ignore FTP?
Been thinking what we can do in these cases. One possibility is translating from JS (similar to how TinyMCE does it). We do a JSONP request that returns an translation object { 'English string': 'Translated string', ... }
. Then on DOM ready we walk the DOM and replace (may wrap all strings in something like <span class="wp-translate">
to make that a bit easier/faster). This may make the page flicker a bit.
Another (better?) possibility would be to get an installation-only .mo file from the WordPress.org API on each page load and use it directly (keep it in memory). Yes, it's expensive and will slow down the 3-4 page loads while installing, but will work in all cases.
This can also be used on the FTP setup screen (right after we are up and running, or before we start?) so the user can install the language pack.
#18
in reply to:
↑ description
@
10 years ago
Replying to nacin:
API
https://api.wordpress.org/translations/core/1.0/?version=4.0-alpha is functional.
Nacin, could you please add English (Australia) to the API ;)
#19
@
10 years ago
Above is an early and incomplete update to the HTML. It uses radios and labels that each have unique classes (currently based on the language, but it could be based on something else from the API) so that they can be styled differently if need be.
It's missing (at least) a few things:
- The fieldset isn't styled based on focus.
- The fieldset doesn't properly scroll when navigating via the keyboard
- The continue input needs a label. We may want to consider actual text here rather than the »
#20
@
10 years ago
28577.diff is looking good. I'm going to do a few tweaks shortly.
#25
@
10 years ago
Why is the styling of the inputs needed? In select
I just type the starting characters of the desired language and I don't need to scroll that much. Here I don't know if english_name or native_name should be used due the key typing.
#27
@
10 years ago
As of [29006], either setup-config.php or install.php work well as entry points. A language chosen during setup-config.php gets passed through to install.php via a simple GET parameter.
I think I'd like to drop a cookie and then read from that, but this current implementation allows for shortcuts like install.php?language=de_DE, which is not bad. We'd still have to thus account for other request variables. (In WordPress, $_REQUEST
is GP, not GPC.)
I moved the assignment back into the if statement (see [28982]) as it improves the branching. I added parentheses to make it a bit more obvious an assignment is there.
More to do here:
- Suggestions — johnbillion said he has some solid Accept-Language code. So do I, but I wouldn't call it solid. Waiting to see his code.
- Language variants — I have an idea here.
- Leveraging string translations via the API — working on this. (jorbin pointed out this is necessary for accessibility.)
- Improved update/error handling — up for grabs.
#28
@
10 years ago
The upgrader doesn't download the language pack even with write perm. Some $GLOBALS and $upgrader output http://pastebin.com/kJruEs2S Couldn't figure it out why. The passed $language was
stdClass Object ( [language] => sk_SK [version] => 4.0-alpha [updated] => 2014-01-01 00:00:00 [english_name] => Slovak [native_name] => SlovenÄina [package] => https://downloads.wordpress.org/translation/core/4.0-alpha/sk_SK.zip [type] => core )
#29
@
10 years ago
The above patch adds in focus/blur styling to the language chooser. These may not be the final colors, but it is something to get us started there.
Next up from me is going to be keyboard scrolling of the inside box when navigating with a keyboard.
Following that, keyboard based searching to jump to the language of your choice.
@
10 years ago
Renamed wp_get_available_translations() to wp_get_available_languages(), removed unused $options from upgrade.php, started error notification
This ticket was mentioned in IRC in #wordpress-dev by johnbillion. View the logs.
10 years ago
#32
@
10 years ago
28577.4.patch adds a first pass at browser accepted language detection, and pushes these languages to the top of the language list, below 'English (United States)' and below the WPLANG language, if defined.
#36
follow-up:
↓ 37
@
10 years ago
- Keywords needs-patch removed
jorbin: The hover/focus styles are looking good. I wonder whether the blurred selected state should be blue though (instead of grey), to liven it up a bit when you first land on this screen.
Also, is anyone else seeing odd jumping behaviour when you select a language which you've needed to scroll down the list to get to? It seems to be related to the presence of the screen-reader-input
class on the radio inputs. If that's removed, the jumping doesn't occur. Only tested so far in Chrome.
#37
in reply to:
↑ 36
@
10 years ago
Replying to johnbillion:
Also, is anyone else seeing odd jumping behaviour when you select a language which you've needed to scroll down the list to get to? It seems to be related to the presence of the
screen-reader-input
class on the radio inputs. If that's removed, the jumping doesn't occur. Only tested so far in Chrome.
I don't see any odd 'jumping behaviour' in Firefox 30, Chrome 38 or IE11.
What I do see though is as I cursor down using arrow keys the scrollbar does not follow the selections as I continue to cursor down so the current selected language is 'off screen'.
e.g Scrolling down to 'Magyar' this is what I see, the scrollbar should follow (Same behaviour in same browsers above)
#38
@
10 years ago
Experiencing the odd jumping in Chrome, but not in FF. Tried to debug http://youtu.be/ONlOrA1v6YU but no success :/
#41
@
10 years ago
[29058] fixes the issues reported variously where English would cause the second language chooser. I had no idea how to reproduce this until I saw ryan's post on make/flow (http://make.wordpress.org/flow/2014/07/09/scratch-install-with-setup-config-macnchrome/).
[29059] fixes an issue when the install.php screen would listen to WPLANG (such as one set up in a wp-config-sample.php file in a non-English zip download) instead of the chosen language. I didn't completely debug it (it doesn't make complete sense to me as $mo->merge_with() should have meant the later language won), but this fixed the issue and was good enough for beta 1. More investigation to follow.
#42
follow-up:
↓ 44
@
10 years ago
Where should I report a small bug on the localizaton of this very installation screen? Spanish message is incomplete in the confirmation screen of "step 2". (after selecting language, vefore starting the installation)
#43
@
10 years ago
Nice, but I still do not understand localization workflow. WordPress 4.0 will be released and translation will not be ready. So users will receive 3.9 localization? And when 4.0 localization is ready, there will be some automatic language update? And how can translators mark translation as complete to allow distribution?
#44
in reply to:
↑ 42
;
follow-ups:
↓ 45
↓ 62
@
10 years ago
Replying to YagoStecher:
Where should I report a small bug on the localizaton of this very installation screen? Spanish message is incomplete in the confirmation screen of "step 2". (after selecting language, vefore starting the installation)
I think you are referring to this string?
We're going to use this information to create a wp-config.php file.
(src: setup-config.php#L126)
This actually affects all locales, the string isn't available in GlotPress for translation.
#45
in reply to:
↑ 44
;
follow-up:
↓ 46
@
10 years ago
Replying to netweb:
Replying to YagoStecher:
Where should I report a small bug on the localizaton of this very installation screen? Spanish message is incomplete in the confirmation screen of "step 2". (after selecting language, vefore starting the installation)
I think you are referring to this string?
We're going to use this information to create a wp-config.php file.
(src: setup-config.php#L126)
This actually affects all locales, the string isn't available in GlotPress for translation.
Actuallly it's this bit
If you are ready, time now to…
(setup-config.php#L318)
...but I can see it's incomplete in the english version, too.
This is the screencap http://prntscr.com/41bc67
#46
in reply to:
↑ 45
@
10 years ago
Replying to YagoStecher:
Actuallly it's this bit
If you are ready, time now to…
(setup-config.php#L318)
Cool, you can update that translation at the following URL (login using your wordpress.org user/pass)
After you have updated it, send the Spanish translation team a quick note http://es.wordpress.org/contact/
#49
in reply to:
↑ 8
@
10 years ago
I'm looking into the possibility of switching back to a select
input (with a size
attribute) rather than our current list of radio buttons.
The current list uses a fair amount of CSS and JavaScript which is just there to get it to look and behave like a native select input. In addition, we're still seeing odd jumping behaviour in Chrome when selecting a language after scrolling down the list, the list doesn't scroll when using the arrow keys to navigate, and typing a letter on the keyboard doesn't jump to a language beginning with that letter.
If we switch back to a select
input, we avoid all these issues. As a bonus, we get the native select UI on Android/iOS devices.
Replying to nacin:
Certain languages are best displayed in certain ways. We need to investigate these. For example, Hebrew should be in RTL including Arabic should be in Tahoma. Of course, this is pretty easy to configure via the API. Might these need to be also aligned right? There's also a language in central Asia that requires its own typeface, if I recall correctly. We will probably need to abandon this multi-line select box in favor of something more robust in order to improve styling.
On Google's language preference screen it lists over 150 language names, all of which are shown in Arial and left-to-right.
After some discussion with nacin, #19950 was mentioned. The Uyghur language requires its own font for general use, but the language name on its own displays correctly in Arial. Uyghur can be found on Google's language preference screen as ئۇيغۇرچە.
#50
follow-up:
↓ 51
@
10 years ago
- Keywords has-patch added
28577.6.patch switches the language chooser back to a select
element (with a size
attribute). Feedback welcome.
#51
in reply to:
↑ 50
@
10 years ago
Replying to johnbillion:
28577.6.patch switches the language chooser back to a
select
element (with asize
attribute). Feedback welcome.
Definitely agree with johnbillion. With <select>
searching by letter keypresses would also work without JS hacking, KISS.
PS: Could we also change that button value "»" to "Continue in selected language", "Continue", "Use language" http://i.imgur.com/ZS2FBIM.png ?
#52
@
10 years ago
+1 for moving back to using <select>
with 28577.6.patch. It seems like we get a lot more compatibility "for free". Plus it's just cleaner overall.
#53
@
10 years ago
This is how the language selector is appearing in Firefox ESR 24.7.0 (latest rev on CentOS 6.5).
What fixed it on my box?
Adding a wrapper div around the fieldset and setting THAT CSS rule to overflow: auto; worked.
in wp-admin/includes/upgrade.php @ wp_install_language_form() add: echo "<div id='language_selector'>"; just before the echo "<fieldset>\n" and close it out with echo "</div>" after the closing fieldset in the same function.
CSS rule added to install.css
.language-chooser #language_selector { overflow: auto; }
CSS rule modified in install.css
.language-chooser fieldset { margin: 1px 1px 0; }
What did NOT work
The problem looks like a FF bug but there are no newer patches for the ESR version at this point.
The Mozilla-specific CSS hack to hides fieldset overflow but does not render the scrollbar.
/wp-admin/css/install.min.css?ver=4.0-beta2-20140720
.language-chooser fieldset { overflow: -moz-hidden-unscrollable; }
overflow: auto;
overflow: scroll;
overflow-y: auto;
overflow-y: scroll;
And a myriad of other options are not helpful.
HTH.
- Lance
#54
follow-up:
↓ 56
@
10 years ago
Thanks Lance. At this point it looks most likely that we're going to revert to a select
element to keep it simple (see 28577.6.patch).
#55
@
10 years ago
@johnbillion - I think select is a wise choice. It has better cross-platform support even if it is a lot harder to craft a nice UX around it.
At least the "div patch" is noted in case others run into fieldset styling issues in the future.
<tangent>It is 2014... why is HTML + CSS styling still such a pain?!?!</tangent>
#56
in reply to:
↑ 54
@
10 years ago
Replying to johnbillion:
28577.6.patch looks pretty good. Couple of small nitpicks: you don't need to add selected="selected"
on the first option, it is selected by default. The different browsers would let you style a <select>
a bit differently, but generally many styles are ignored on <option>, perhaps the font-size can be 18px to make it a bit more prominent. And of course the size (visible rows) can be changed from JS, perhaps useful for mobile.
#59
@
10 years ago
The color contrast for selected elements is 4.473867036212602:1 . WCAG 2.0 AA Guidelines suggest a minimum of 4.5:1 for small text (less than 18 point). 1 pixel is roughly 1 point, so if we bump the font up 2 px, we will meet that guideline. Additionally, I think the slightly larger font is easier to read.
#60
@
10 years ago
Where can be language name "čeština" changed to "Čeština"? Should I create new ticket?
#61
@
10 years ago
Hey Pavelevap, There is a ticket about that on the GlotPress trac. See https://glotpress.trac.wordpress.org/ticket/342.
#62
in reply to:
↑ 44
@
10 years ago
Replying to netweb:
We're going to use this information to create a wp-config.php file.
(src: setup-config.php#L126)
Have created a new ticket for this issue and another string in #29233
#64
follow-up:
↓ 65
@
10 years ago
At WordCamp Maine Contributor's Day I tested installing the latest nightly, and saw a few issues which I didn't see mentioned here and couldn't locate separate tickets for.
- After installing (on wp-admin/install.php?language=xx_XX) there is a link at the top to the readme.html file; the readme.html file is in English. Is there any way for it to download a translated version if a language other than English is chosen and display that readme file instead of the default one?
- After installation is completed and visiting Settings -> General (on wp-admin/options-general.php) there is an option for Site Language, which lists all installed languages. However, instead of using the language name in the drop down, it uses the locale value, which may be confusing to an end user that may not know his specific regional code.
#65
in reply to:
↑ 64
@
10 years ago
Replying to Blaine Moore:
- After installing (on wp-admin/install.php?language=xx_XX) there is a link at the top to the readme.html file; the readme.html file is in English. Is there any way for it to download a translated version if a language other than English is chosen and display that readme file instead of the default one?
Yeah, it's planned to download the localized readme.html too.
- After installation is completed and visiting Settings -> General (on wp-admin/options-general.php) there is an option for Site Language, which lists all installed languages.
This is WIP and will be improved, see #15677.
28577.diff is a first pass.