When I select a language to install Drupal in (see #1260716: Improve language onboarding user experience for improvements to that), Drupal installs with TWO languages. It has English, which is (a) kept enabled (b) cannot be deleted. It also has language selection and detection, which does not make sense for a single foreign language site. It is always going to be one langugae. So it distracts you into things that are not at all relevant to you.

We've been talking about this for some time now, but this needs a bit better UX vision here. Drupal has four use cases here:

(A) English website, fine with the built-in UI text, no locale module enabled/needed
(B) English website with customized UI text, locale module needed => problem English cannot have translations (will be another issue TBD)
(C) Single foreign language (focus of this issue) => problem (1) detection makes almost no sense (minus maybe forcing the path alias prefix from the get go, but otherwise it is confuuuuusing), (2) English cannot be removed (TBD with the issue above)
(D) Multiple languages => possibly no problem since we need to have a list of them with settings, enabled ones, default, selection, etc. so if we can improve the UI good, but it is at least OK

All-in-all the main focus here is (C), to make this page work better for that case. So far, we discussed making it more like the theme admin page, where you have a prominent default and the rest is kind of de-emphasized, but the same layout definitely does not apply. Maybe a similar concept, but not the layout :)

Some problems pointed out on this screenshot:

Parent

#1260690: META: Improve multilingual user experience in Drupal 8

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

In D7 we have the possibility to hide native English, it's just matter of exploiting it :)

http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/langua...

Bojhan’s picture

So, the focus of this issue is a bit confusing because much of it is related to removing English from this list. This screen can be better, for example no drag and drop, no default, no "enabled" in the case of one language. Also dropping the selection tab.

Additionally, can we move setting the default to the "edit" page?

Jose Reyero’s picture

I think to fix that UI we should fix first the API / modules / conceptual approach for which it is just the visible part. Copying some notes from here http://groups.drupal.org/node/161589#comment-542474

Language should be a 'core' concept somehow independent of localization or translation. In the same way you select a Country and a Timezone for your site you should be able to select also a language. Then you would have a single language site that may have the UI in English but that may only be seen by the site administrator.

(Whether locale is enabled automatically after you select a language for your site is a question of the install profile. Entry level install profiles should do that.)

One more step would be having a 'multilingual' site. Then you need a list of languages (current locale language configuration) a default one, etc. With our current set-up, by enabling locale, just because you want a single (non English) language site, the user runs into language lists, default language, etc, which are things we could save. Actually you have a bilingual site when all you want is a single language site but not an English site.

In short, translating into UI:
1. One language, you have a drop down, produced by system module.
2. More languages, you have radio buttons, like current UI more options (enabled, disabled, etc), provided by locale module
3. Language list is a core concept (system module) pretty similar to country list, only more configurable.

Gábor Hojtsy’s picture

@plach: yeah, well, we are looking to make it usable for mere mortals though :)

@Bojhan: ok, good plans. On moving default to the edit page, when you switch default, it is about two languages at once. The old one becomes not the default and the new one becomes the default. So it really affects two languages, not one. Also, I think default language is a VERY important piece of information here to show, losing that would not be good. All this applies of course when you have multiple languages, we can definitely loose that if you have one only.

@Jose: part of my motivation to open this issue was your comment there :) However, you seem to have lost some of your text in submission(?)

Jose Reyero’s picture

(sorry, fixed the comment in #3, bad markup..)

tkoleary’s picture

FileSize
177.62 KB
96.32 KB

UX designs attached

Gábor Hojtsy’s picture

Status: Active » Needs review

Thank you, now needs review (on the design).

yoroy’s picture

Interesting start. I'm attaching a first pass review of the design with a bonus unrelated question.

The objective here though is to improve display of the single-language situation. It would be good to see that state mocked up in here. I'm interested to hear why the switch away from the default table for listing languages, instead going for something resembling the themes listing on Appearance page.

Gábor Hojtsy’s picture

@yoroy: our discussion started with improving this for the mono-foreign language websites. Where you have a non-English site but only that one language. Displaying that one language in a table with ordering, enable/disable/default, etc. controls does not make much sense really. We don't have stats but can IMHO assume there are lots of single-foreign-language sites out there. So how do we have a UI which makes lots of sense for them and scales to more languages.

BTW the design does lack reordering capability for the (enabled) languages, that should not be lost.

On your comment that this adds "regions" to the seven theme, well, it was originally designed to have that. The modules' screen would have had an application launchpad there (http://www.d7ux.org/images/IA_Config.png), the content editing screen would have had buttons, categories, tags, etc. there (http://www.d7ux.org/content/). We indeed did not end up with actual implementations of "regions" in Seven, except Dashboard.

Gábor Hojtsy’s picture

Opened #1266318: Make English a first class language to be able to remove English on sites where we don't need English.

Gábor Hojtsy’s picture

Issue tags: +montreal

Discussed a LOT at the Monteral sprint. Feedback coming up.

Mirabuck’s picture

Hello everyone,

Here are my notes on our discussion of this issue at today's code sprint. Please correct or add to them if you see anything I've missed.

Montreal Code Sprint Notes and Recommendations

  • English should be an editable, translatable removable language separate from default text used with interfaces.
  • Concerns were raised that the UI depicted in #6 and #8 above would be unwieldy on sites with numerous languages. The bulk of the comments that follow relate to current UI as depicted in the issue summary.
  • The direction column should be removed.
  • Rows for disabled languages should be greyed out with an 'enabled' checkbox still exposed.
  • A translation status column should be added depicting the percentage of text translated for each language depicted.
  • The 'Add Language' action link should be replaced with a select list similar to the one described in the code sprint notes for issue 1260716.
  • It was suggested that an action link be added alongside this for adding custom languages.
Jose Reyero’s picture

Some more mixed thoughts about the UI:

- What's that Language name in English? Shouldn't we just display the language name in the current locale? Then maybe show the proper language name somewhere but in any case the primary language name should be consistent with current locale.

- Having 'disabled' and 'non-existent?' languages is somehow confusing and limiting. I think we should consider al languages as 'existing' in the first place and have only Enabled and Disabled ones. We don't really need 3 different states for languages. Though it would make some sense if content in disabled languages got unpublished somehow.

- The old rows display was cleaner and more escalable IMHO (and allows reordering as Gabor points out)

So I would rework the display basically as:
- Rows of enabled languages.
- Rows of disabled languages (still with their edit/delete option), but this could be a collapsed section and maybe 2 cols so its shorter.
(Some option to add a custom language *at the bottom of the list*, search first, add if not found)

Adding a language is something that usually happens at site set up and then maybe once a year so we shouldn't optimize the UI for that. *We should optimize the UI for administering currently enabled languages* Then if we want an autocomplete for quick search, fine, but it could go at the top and filter both enabled and disabled languages.

Gábor Hojtsy’s picture

@Jose: yes, I think we did agree with you a lot :) When looking at the above mockups, our ultimate conclusion was that really, adding languages rarely happens. What you want to come back for is to (a) configure them but really not that much and (b) have an overview of your languages and your translation status (with the translation status leading out to pages like the UI translation screen and the node admin overview once it has better language support as discussed now in #1279624: Add translation filter to content listing admin page and #1279652: Add title search feature on the node listing admin page.

@Jose: I agree displaying the language name in the current locale only is best. We do that elsewhere. You can still edit the "English name" and the "Native name" on the language screen. Once we figure out the configuration language problem, we might get rid of the "English language" field altogether, it is kind of a hack to be able to use this in t() even though its user provided. I know, I know, this is what we tell people should not do :) But even then if we have this hack in place, only showing the language in the admin's language would IMHO be consistent with the rest of the UI a lot (and save lots of space and confusion - I mean the current table only shows the name in English and its native name, but never in your language that you use to administer, pretty broke, right? :).

@Mirabuck, @Jose: on disabled and enabled languages, we did discuss a lot of what does that mean. What happens when you disable a language? What does it disable it for? We could not come up with a different use case but the "I'm building out this site, and want to have this language around but not make it visible yet to everyone" use case, where modules like i18n and entity_translation can/do expose disabled languages for node forms, etc. So we discussed making that a permission instead, like "Use German language" or something along those lines, so you can grant that permission to your admins while your regular viewers don't see that yet. This looked rosy, but unfortunately it has interesting implications for combining permissions, ie. making this co-exist with other node permissions on the system. But this underlying question of what "Enable" means, what does it enable the language for is coming up repeatedly. (And we discussed before to have multiple lists of enabled languages depending on what you use them for, like user preferences, or entity language or language selector blocks, etc.). I don't think we had a clear direction there. More use cases of what people use this for and what this should support would be good.

@Mirabuck: in my recollection, I don't think we agreed on that we should move away from the action link, and instead discussed the page that the action link leads to, so we can keep the pattern of these pages like elsewhere. @Jose: I think if the kind of pattern you suggest would be used widespread in Drupal, we should adopt it, so far I think the only place this is being used is the field UI and the permission roles UI I think. Are there other places that I missed? Maybe two is enough to say its a standard though and move on with that. Ha :)

Gábor Hojtsy’s picture

Title: Single language UX is bad » Rework language list admin user interface

Retitling for our shifted focus.

Jose Reyero’s picture

@Gabor
Oh, right we've really shifted the focus here :-( Then I'm not sure there's anything wrong with the current language admin UI...

About using disabled languages for anything that's just an (my) ugly hack and we should look for something better. Like keeping this page for defining languages in general and have somewhere else interface languages and content languages defined (I think there's an issue abt that, cannot find it now).

(It was just easier to use disabled languages than to add another page to define content languages which is what we should have done and what I'd like for D8).

Really, when you start using disabled languages for anything, the 'Enabled' option just means use as an interface language. Then the 'Existing' one (having the language defined) means it can be used for content, or for anything else. The whole thing gets confusing.

So I am wondering wether this could be better the place to define a list of languages. Nor disabled nor enabled nor anything, just a plain list of languages (code, name, ....). Then somewhere else we decide which ones we use for UI, which ones for content, which is the admin language, or which ones as a value for a language Field for an entity....

Gábor Hojtsy’s picture

Ok, here is a first pass of something useful based on the above discussions and our Montreal plans explained above. What had changed?

- English name and Native name (useless columns) removed in favor of Name, which is now translated to the admin UI, so admins can see it in their own language
- Language code column is gone (who needs it?), and added a Link column that informs you where is that version of the site (this will only be meaningful if you do have URL negotiation turned on and if you have others taking preference, it might not work, so this is a bit tricky)
- The enabled column/feature stays for now, this is a much bigger change that should happen in another issue, but its a good idea to make this more versatile
- The interface translation section looses its very empty overview screen and instead the language list receives the pluggable ability to put in columns for stats on language; so far only interface translation implements it, but content translation, config translation, etc. could in the future; + for extra fun, the interface translation stat actually links to the interface translation UI (badaboooom!)
- I agree this looks a bit odd for English now, but we fully expect in Montreal to have #1266318: Make English a first class language sometime hopefully soon :) - so I did not bother much to optimize for that, since we'd like to drop that anyway
- Finally a subtle change, but we also discussed just renaming "Translate interface" to something more humane like "Interface translation", because the old name makes people thinks its an interface for translation overall, which is not at all the case :)

Screenshot with comments:

Patch coming.

emarchak’s picture

We're talking about this page in a lot of issues - perhaps we should open up a meta issue to talk about what it actually contains and allow the individual issues to deal with the single challenges.

Here's a mockup of the Languages page that contains inspiration from Jose Reyero's request in #1260860: Rework language list admin user interface, Gabor's previous comment, and #1266318: Make English a first class language. My own addition was adding in an easy css visual representation of the completeness of the language.

  • The graph makes it a little more pleasing, some quick information that isn't just cold numbers, but
  • More importantly, it gives this table the space to include many more columns of stats.
    If five modules use that hook to display items, the table will be overloaded. But, if we just shrink the bar and hide the text with overflow:hidden; it's accessible, AND lets us populate this page with all of the information we need.

Gábor Hojtsy’s picture

Some background info on my and @emarchak's work based on our review yesterday with 5-6 people in Montreal:

- we found above that adding language is a setup operation you do here, but not too often after that, so @koleary's design for adding language over-emphasizes that, we should not focus on adding language as much here
- we can however reuse the field UI and the role UI pattern to have an inline piece to add a new language, that is an existing core pattern people will know (from the field UI) - whether its a good pattern we can debate :) I think on @emarchak's mockup, the link field is not something we want people to enter like this, so that does not look good there, but except this can be useful, up for debate I guess
- we wanted to give meaning to this page beyond adding and configuring languages, since this was the only useful overview of languages in core, so therefore our integration of the translation/language status here, again up for debate :)

Here is a patch that implements the above screenshots, not (yet) the mockups. Let's discuss. The code is somewhat of a proof of concept, but its pluggable and organized relatively well hopefully, even if it needs some cleanup.

tarmstrong’s picture

@emarchak

Just nitpicking. I like the progress bar, but it needs a better label. The interface being 95% done is a little disconcerting, taken literally.

Maybe "Strings translated"?

emarchak’s picture

@tarmstrong

I agree completely, but we'll have to think of a short label, as this table could get over populated very quickly. Maybe something like "Completion," or "Progress"? Although that sounds like an upload status :P

tarmstrong’s picture

@emarchak: "Completeness"? (Which I think is subtly different from "Completion")

Status: Needs review » Needs work

The last submitted patch, cleanup-language-list-ui.patch, failed testing.

Mirabuck’s picture

"in my recollection, I don't think we agreed on that we should move away from the action link, and instead discussed the page that the action link leads to, so we can keep the pattern of these pages like elsewhere."

@Gabor: We had talked about having something in the action link area to add new languages (now inside the table in #18). I assumed that we were looking at removing the action link and replacing it with this.

I think the #18 language search within the table makes a great deal of sense. I like that it mirrors existing patterns from things like field API. The progress bar style for translation seems a bit more graceful than a fraction and a percentage.

Gábor Hojtsy’s picture

@Mirabuck: @emarchak: well, well, repurposing the action area is tricky, because we have a standard there that people understand and expect. I think the language addition in the table look good and is consistent with field management (and roles), but I think we need to figure out how to add custom languages (those not in the dropdown) that way. I think it would be best if we had one interaction model, either the action link only or the in-table language addition only, which needs to support custom languages. Having both interaction models sounds pretty confusing.

@emarchak: I'm not sure that having the link field as input is a good idea there. Basically you either configure a domain or a path otherwise, and this is just a derivative of that, so making you enter that here would be complicated. Also, the language editing screen gives a lot of context as to what domain and path means and entails, so lacking that info, users would IMHO could just fool around here.

Mirabuck’s picture

More comments about having the add language UI within the table as seen in number #18: If this is implemented with a select list, language names should probably be presented in the language being used by the admin user. It's not clear to me what the function of the text box is. I suspect as well that a button of some sort is needed to trigger the add language process.

I missed some discussion on the topic yesterday, but after speaking with emarchak it sounds like there was some debate as to whether or not a UI like this is to quickly add languages is necessary in a situation where most users are going through this process only a few times.

Edit: I posted this without seeing #25. The text box I suppose is was meant for adding custom languages. I wonder if this could be handled by making 'Custom Language' an option in the select list and pushing users to an interface for adding custom languages only when this is chosen.

Gábor Hojtsy’s picture

Here is a quick update that includes a reorderable "Add new language" item in the table. It should eventually support the enabled and default radios/checkboxes, but the server side does not work yet. Need to figure out how to make custom language integrated into this. Looking for feedback.

sylvain_a’s picture

Amazing work has been done this weekend!
Suscribing!

giorgio79’s picture

About this option
"(D) Multiple languages => possibly no problem since we need to have a list of them with settings, enabled ones, default, selection, etc. so if we can improve the UI good, but it is at least OK"

I notice if someone wants to add all languages a lot of clicking on "Add Language" would be required at the moment. (With Facebook Connect it is much easier for a site to go global.)

We could get this by listing all available languages in a VBO like table with the ability to select all instead of the current single dropdown select. Perhaps we could even do away with the "Add Language" screen, and have a list of all available languages with enable disable VBO like checkbox, filtered to show the top ones so it is not overwhelming.
#1288936: Add multiple / all languages easily - currently we can only add languages one at a time Redirected this request here

Gábor Hojtsy’s picture

@giorgio79: We've been doing lots of thinking on the add language experience. And really, how common it is for a website to add tens of languages? What do you think? Building a website is primarily about building out the structure and content (as well as interactivity). The built-in tools can translate the UI for you but all the structure and content you still need to build out yourself in those languages. Adding a language will not make it magically work without further effort.

giorgio79’s picture

Thanks Gábor, please see my anwsers:

1. "And really, how common it is for a website to add tens of languages? What do you think?"
I guess it was not common so far, for one reason because it is difficult with the current tools be it Drupal or another CMS. Another reason simply could be it is not needed for lots of websites. That does not mean that many others dont need it and it has to stay as it is. I am sure webmasters that needed lot of languages have looked elsewhere as well.
For example, I understand you work at Acquia, and winning an EU CMS contract would need strong multilingual capabilities. An EU government site has to provide minimum 3 languages, but preferable 20-30 for all the member states. Check out http://europa.eu . How many language options do you see there?

What I am saying is a VBO like setup could be put up there in 2 minutes where users can tick the languages they want and see all the existing languages in a nice filterable views. :) If not that is fine as well, I will just write an imacro for adding all those languages.

2. "Adding a language will not make it magically work without further effort."
That is where user generated content comes into the (or at least my) picture. Just like Facebook asked its users to help translate the interface. I am not building a facebook clone, just a social app that can be used all over the world as an fb app.

Gábor Hojtsy’s picture

@giorgio79: turning your two examples against each other, the EU commission is a great example of an organization who would never crowdsource their translation needs and would incur increasing costs as more and more languages are added. Once again, the thinking with the above is that adding languages is usually a one-time operation and people return to this page to configure languages and get useful info about their status. Showing a monster list of languages at all times just to ease the initial setup would turn this screen to focus on what is done less. Drupal 8 is working to make adding languages use a clean API, so you'll be able to write code to add languages with any kind of UI you want. See #1215716: Introduce locale_language_save().

giorgio79’s picture

Thanks Gábor, I was just presenting two separate use cases, certainly the EU would never crowsdource the translation of its website. :)

Just a final try if you dont mind, feel free to delete this post if you dont like it:
I still think presenting a nice Views with VBO for available languages would make sense, and this view could give more info on the status of a language instead of a single dropdown box. It could have columns like %ready etc.
We could present 2 Vertical Tabs, one for Enabled languages, another one for Available Languages. :) This way there would be no clutter.

Gábor Hojtsy’s picture

@giorgio79: even localize.drupal.org has almost 100 languages available. Showing a table with all of them in place would more likely make this harder to understand for people even if it would indeed make it easier to add 20 languages at once (which is less likely to happen).

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
74.5 KB
14.05 KB

Updated patch based on discussions in person in Montreal and since then.

1. Removed the link column from the table since people indicated it draws too much attention. With the excellent issue at #1280530: Decouple domain/path negotiation setup from language configuration, path and domain setup is moving to the negotiation configuration area, where the links will be evident.
2. Removed the inline add language functionality for this patch, so we can keep scope under control. Opened #1295814: Move "add language" action to inline table form item, like field UI for that and marked postponed on this issue. Making good progress is much better than trying to solve all the worlds problems in one patch.
3. Took some time cleaning up the structure used by hook_locale_language_stats(), IMHO it looks pretty good now. I made it so that each language/stat type pair would provide its own unique link. Even though we don't need this for locale, content will probably need this.
4. Did not spend time pretty-fying the progress numbers to progress bars. I don't think we should do that in this concrete patch, trying to avoid bikeshedding that :)

I think this is a self-contained solution that could go in in itself, so please provide your feedback!

The UI looks like this (vs. the original UI that can be seen in the OP):

LanguageListSimplified.png

Lars Toomre’s picture

Small nit... 'n/a' sometimes means 'not available' and at other times 'not applicable'. Why not replace the 'n/a' text for English in the interface translation column with either "Not applicable' or perhaps even better 'Always present'?

Gábor Hojtsy’s picture

@Lars Toomre: we are working to make English a first class language, so it might not always be present. Once #1266318: Make English a first class language lands, this table will have the same type of information / capabilities for English like all other languages. See mockups to that effect above in #18. That kind of visualization of the system built-in English is possible once both this patch and the first class English patch are committed, so neither patch includes that visualization for now. So all-in-all n/a will go away soon hopefully from this table either way, so we don't need to worry about it much.

Lars Toomre’s picture

@Gábor - re: #37: So once both patches land, the English row in #35 would have the enabled check box active, an interface translation cell something like '1665/1665 (100%)' and both edit and delete operations? Is my understanding correct? If so, my small nit comment in #36 is Not applicable! LOL

Gábor Hojtsy’s picture

@Lars Toomre: you can see screenshot of how this would look like in the other linked issue :) The Enabled checkbox is only disabled because its the current default language on the screenshot, it is always disabled for the current default, since you should not be able to disable that.

Status: Needs review » Needs work

The last submitted patch, language-list-ui-rework.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
15.72 KB

Tests were failing due to looking for items now removed from the table. Changed so that the language code is now checked from the source code (its not visible on the UI anymore). Should pass tests now.

sun’s picture

Status: Needs review » Needs work
+++ b/modules/locale/locale.admin.inc
@@ -54,8 +52,17 @@ function locale_languages_overview_form() {
+  $form['stat_values'] = module_invoke_all('locale_language_stats');

1) The hook name should not contain an abbreviation... make it hook_[locale_]language_statistics().

2) Same for the $form structure key; why not simply 'statistics'?

+++ b/modules/locale/locale.admin.inc
@@ -54,8 +52,17 @@ function locale_languages_overview_form() {
+  $form['actions'] = array(
+    '#type' => 'actions',
+    'submit' => array(
+      '#type' => 'submit',
+      '#value' => t('Save configuration'),
+    ),
+  );

That's a very unorthodox way for declaring form actions/buttons ;)

$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
  ...
);

plz :)

+++ b/modules/locale/locale.admin.inc
@@ -90,23 +100,48 @@ function theme_locale_languages_overview_form($variables) {
+      // Add individual stats columns to language overview.
+      foreach ($form['stat_values'] as $stat_index => $stat_type) {
+        if (is_array($stat_type) && isset($stat_type['#title']) && isset($stat_type['#values'])) {
+          $stat_headers[$stat_index] = $stat_type['#title'];
+          if (isset($stat_type['#values'][$key])) {
+            if (!empty($stat_type['#values'][$key]['path'])) {
+              $row['data'][] = l($stat_type['#values'][$key]['value'], $stat_type['#values'][$key]['path']);
+            }
+            else {
+              $row['data'][] = $stat_type['#values'][$key]['value'];
+            }
+          }
+          else {
+            $row['data'][] = '';
+          }
+        }
+      }
...
+      $row['data'][] = l(t('edit'), 'admin/config/regional/language/edit/' . $key) . (($key != 'en' && $key != $default->language) ? ' ' . l(t('delete'), 'admin/config/regional/language/delete/' . $key) : '');

This complex logic does not belong into a theme function. We can already prepare and build proper renderable array elements in the original $form structure.

Use #type 'markup' and 'link' respectively. Meaning that we end up with a couple of simple drupal_render()s in this theme function.

+++ b/modules/locale/locale.admin.inc
@@ -90,23 +100,48 @@ function theme_locale_languages_overview_form($variables) {
+  // These contained elements we rendered above, so we don't need the markup
+  // wrapper for them polluting the end of the form.
+  drupal_render($form['enabled']);
+  drupal_render($form['site_default']);

This entire form structure looks very weird to me. Normally you'd do $form[$key]['foo'] if your intention is to render the output as a table. That $form['foo'][$key] structure is the primary cause for why this theme function and surrounding code is a lot more complex than it would have to be.

+++ b/modules/locale/locale.module
@@ -48,16 +48,13 @@ function locale_help($path, $arg) {
-      $output = '<p>' . t('This page provides an overview of available translatable strings. See the <a href="@languages">Languages page</a> for more information on adding support for additional languages.', array('@languages' => url('admin/config/regional/language'))) . '</p>';
-      return $output;
+      return '<p>' . t('This page allows a translator to search for specific translated and untranslated strings, and is used when creating or editing translations. (Note: For translation tasks involving many strings, it may be more convenient to <a href="@export">export</a> strings for offline editing in a desktop Gettext translation editor.) Searches may be limited to strings in a specific language.', array('@export' => url('admin/config/regional/translate/export'))) . '</p>';

1) "a translator" -- so, not me, as I'm looking at the page?

2) Overall, this can be heavily shortened and made less wordy. The help/usability team can support here.

3) Let's retain the $output variable (as I'm fairly sure this will turn into 2 paragraphs, if the note is being kept).

+++ b/modules/locale/locale.module
@@ -135,25 +132,17 @@ function locale_menu() {
+    'title' => 'Interface translation',

Wondering whether "User interface translation" wouldn't be more concise (and also better for translation)?

+++ b/modules/locale/locale.module
@@ -135,25 +132,17 @@ function locale_menu() {
+    'page callback' => 'locale_translate_seek_screen', // search results and form concatenated

1) Let's drop the in-line comment.

2) That page callback function name confuses me for more than five years already.

+++ b/modules/locale/locale.module
@@ -135,25 +132,17 @@ function locale_menu() {
+    'weight' => 0,

Normally, we assign -10 here, if we assign something, no?

+++ b/modules/locale/locale.module
@@ -1056,3 +1045,39 @@ function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
+ * Implements hook_locale_language_stats().

Missing API documentation for this hook.

+++ b/modules/locale/locale.module
@@ -1056,3 +1045,39 @@ function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
+  // Set up overview table with default values, ensuring common order for values.
+  $stats['#values'] = array();

You need to decide whether this is a hook that returns statistical data and numbers, or whether it is a hook that returns a form section/structure/element(s).

Right now, it appears to want to be both, and that doesn't really make it beautiful.

If you want a hook that extends a form, lemme hand you a present: hook_form_locale_language_overview_alter() ;)

And in fact, yes, this looks like a simple hook_form_alter() use-case to me. There's not really a point in abstracting this data and form construction that much.

+++ b/modules/locale/locale.module
@@ -1056,3 +1045,39 @@ function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
+      $stats['#values'][$langcode] = array('path' => '', 'value' => t('n/a'));

This "n/a" is actually bogus. It says "not available", but in fact, all strings are available, not the opposite.

+++ b/modules/locale/locale.module
@@ -1056,3 +1045,39 @@ function locale_form_comment_form_alter(&$form, &$form_state, $form_id) {
+      $stats['#values'][$langcode] = array('path' => $path, 'value' => '0/' . $num_strings . ' (0%)');

It would be beneficial to have the raw data/numbers available in array keys.

-3 days to next Drupal core point release.

Tor Arne Thune’s picture

+++ b/modules/locale/locale.admin.incundefined
@@ -90,23 +100,48 @@ function theme_locale_languages_overview_form($variables) {
+  // These contained elements we rendered above, so we don't need the markup

Should it be "These are the..."? Had to read the comment a couple of times to understand it.

+++ b/modules/locale/locale.moduleundefined
@@ -135,25 +132,17 @@ function locale_menu() {
+    'page callback' => 'locale_translate_seek_screen', // search results and form concatenated

In-line comment on separate line above starting with capital letter?

Otherwise the code style looks good. Can't comment on the logic :)

Gábor Hojtsy’s picture

@sun: right, most of the complexity of the theming function and the need for a separate stats hook comes from the form not being very friendly to altering (and having a simple form function due to that). We can turn this upside down and make the form resemble more of the table we want to output and provide data in that structure which could allow for form altering to go in and add elements proper. I agree that looks to be the better way. I was pondering about doing the stats hook as form alters originally but it looked ugly with the current form structure. Agreed it is probably better to redo the form structure, but it will need to use awkward checkbox and radio button patterns to group them up proper for input (or a more involved form processor).

sun’s picture

Status: Needs work » Needs review
FileSize
22.64 KB

Revised.

Status: Needs review » Needs work

The last submitted patch, drupal8.language-ui-list.45.patch, failed testing.

Gábor Hojtsy’s picture

@sun: patch looks great, much better structure for the them. Looks like it breaks lots of tests though, mostly due to the enabled and default checkboxes/radio buttons changing structure.

I've slept on one of the red flags in my original patch which was carried over to yours, namely the check_plain(t($language->name)) conundrum. I think this is as good a time as any to start getting rid of t($user_data) here. Drupal core should not do this :) Yes, I've introduced it for languages and yes, I have a massive campaign educating people not to do it. So its time to not do it in locale.module either. I've opened an issue at #1301148: Stop pretending we have configuration translation for languages to clean up those areas not affected by this patch (plenty), but you can skip doing t() there for now. We'll need to come back add real translatability support once we have translation for configuration (and moved language config storage to the config system). That is pretty much out in the future though.

Otherwise, minus the test failures, this looks beautiful! :)

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
30.91 KB

Just attempted to fix test failures for now. Changes in tests to use the new enabled checkbox and change to provide specific #id attribute to radio buttons for defaults to aid testing.

Status: Needs review » Needs work

The last submitted patch, drupal8.language-ui-list.48.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
30.91 KB

Rerolled for invalid PHP in test.

Status: Needs review » Needs work

The last submitted patch, drupal8.language-ui-list.50.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
32.62 KB

Updated patch includes test fixes to now look for the new form structure + renamed functions from languages_ to language_ to conform to discussions in #1296566: Improve usability of add language screen + removed t() on user editable language name as discussed above. Should hopefully pass tests now.

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! Looks ready to fly for me.

Gábor Hojtsy’s picture

#1280530: Decouple domain/path negotiation setup from language configuration was committed which did not make this patch fail but required some offsets. Rerolling and making sure it still passes proper. Same patch no changes whatsoever.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Great patch.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Gábor Hojtsy’s picture

Issue tags: +language-base
Gábor Hojtsy’s picture

Issue summary: View changes

Fix image URL.