Motivation
On most foreign language or multilingual Drupal 8 sites there will at least be views in 2 different languages, the English views shipped with Drupal core and the Views created on the site for the site's foreign language. On multilingual sites, it is possible there will be views that do not apply to all languages and therefore only created in specific languages (although that is more of an edge case).
The shipped views are in English and they should say so in their configuration yml files. See #1935000: Some configuration entities are created as in language unknown which covers views.
However when users edit/create views, we should give them the ability to specify the language for their views. Why is this important? Well, only English shipped views are translated with the localize.drupal.org .po file system. Second, knowing which source language is used lets the configuration translation system offer it up for translation in other languages.
As an example in core, vocabulary config entities already have a language selector for the same reason (the tags shipped vocabulary is also English).
I think on the Views UI this would likely belong in the "edit name/description" popup screen, because those are the high level properties of the view.
Follow-ups
Comment | File | Size | Author |
---|---|---|---|
#42 | drupal-1935022-42.patch | 10.05 KB | dawehner |
#42 | interdiff.txt | 473 bytes | dawehner |
#40 | drupal-1935022-40.patch | 10.02 KB | dawehner |
#40 | interdiff.txt | 444 bytes | dawehner |
#35 | drupal-1935022-34.patch | 9.58 KB | dawehner |
Comments
Comment #1
Gábor HojtsyAll right, figured out we don't have langcode exported for .yml in Views even, so removed those from #1935000: Some configuration entities are created as in language unknown and this is the only issue for it. Here is my suggestion.
Comment #2
Cameron Tod CreditAttribution: Cameron Tod commentedHow does this relate to the content actually in the view?
For example, if a view contains a listing of Hungarian language nodes, but the View is set to English.
Does this language relate to the labels, titles, and other properties of the View, as opposed to its results?
Comment #3
vijaycs85@cam8001 description of the element says "Language of the labels and other textual elements in this view". So looks like, it is for properties of view.
Comment #4
Gábor Hojtsy@cam8001: yes, this is limited to the properties on the view, its displays, etc. Titles, empty texts, labels, etc. Essentially any textual input that will be translatable. It is important we know this language, so we can translate the view to other languages as needed. The empty texts, labels, etc. What kind of language filtering is active on the content displayed using the view itself is configured with the filters as usual. This language only corresponds to the textual configuration that you configure within views UI.
Comment #5
dawehnerThat's great. I'm wondering whether we should adapt all test views configs as well, but that feels like a little too much.
During testing I had an issue with language module disabled, which is fine, but the question is whether this code should be wrapped with an module_exists?
Other places like the node edit form doesn't do it, so this seems fine.
Added a small adaption to one of the tests.
Comment #6
Gábor HojtsyNice test update! No, there is no reason for module_exists, language_select is a core type that falls back in itself to a value field if there is no language module enabled. In that case obviously you cannot change the language, but that is to be expected. You should not have multiple languages if you don't have language module enabled, so no way to switch to any other language is natural :)
Comment #8
Gábor HojtsyCustomBlockTranslationUITest fail should not be related.
Comment #9
Gábor Hojtsy#5: drupal-1935022-5.patch queued for re-testing.
Comment #10
YesCT CreditAttribution: YesCT commentedIs this per view, or per display?
Comment #11
Gábor HojtsyPer view. That is on a global level for the whole config .yml for the views. One view one language. You are expected to use the same language across your view. You can than translate that to other languages with http://drupal.org/project/config_translation.
Comment #12
dawehnerYeah it got green. As gabor didn't had something to complain about that test, this feels RTBC. @YesCT: Do you want to have the honor? :)
Comment #13
dudycz CreditAttribution: dudycz commentedlooks ok for me
Comment #14
YesCT CreditAttribution: YesCT commentedI can't look at it till later tonight, so, proceed. :)
Comment #15
YesCT CreditAttribution: YesCT commentedI already double checked.. I'll tripple check later.
But:
http://screencast.com/t/9mmej4sc
I dont see the langcode in the .yml file for the active config.
Comment #16
YesCT CreditAttribution: YesCT commentedAh, talked to @Gábor Hojtsy in irc, and he pointed out it might be at the end of the active config file. it was.
$ diff core/modules/views/config/views.view.frontpage.yml sites/default/files/config__rzyR0s0KXhc9jjr4I7HQl3nK300t-85ew12vzYGO2A/active/views.view.frontpage.yml
I think this is *not* a problem with this issue, but a separate issue. I'll open that separate issue. There were similar things found while working on the schema issues, so I'll link those to see what we did for them, in terms of ensuring that the save is repeatable: that the order is the same each time it's saved.
Comment #17
Gábor HojtsyThanks for double checking. This should be RTBC then.
Comment #18
YesCT CreditAttribution: YesCT commentedsteps to test
uh, I dont get the page as shown above...
I get:
Comment #19
YesCT CreditAttribution: YesCT commentedcontinuing the steps.
8. save the view [edit: added screenshot]
in the active config, the yml for that view ends like:
should that be en?
Comment #20
Gábor HojtsyI don't think a language selector has a place in the views wizard. The 80% use case even on a multilingual site is you create a view in the site's default language, and then translate to other languages from there. So I'm not sure it makes sense on the wizard to have a language selector. However the view should be created in the site's default language automatically, not und. It has human readable text, there is no way it is und :) So the missing piece seems to be the initial view creation should use the site default language, not the und default in config entities.
Comment #21
YesCT CreditAttribution: YesCT commentedbest practices and 80% thoughts
note, from irc with @Gábor Hojtsy
So that is a reason for *not* showing the language select in the add view.
9. the view
10. edit the name to change the language
that is .. strange. will need to change the button to name/description/language? that's a little long for a button name. it's also the place to change the tag.
Lets change the button to something like: change the overall view information. Hm. I'll think more on that in a bit.
11. language options in select
11 a.
Should the language options here be similar to those allowed on content?
Maybe they are...
Oh, I was thinking of this drop down on the default language selection. That is (for content) the select for picking the default language, not the actual language select.
11 b.
11 c.
Do we want to include Not specified and Not applicable ?
Comment #22
YesCT CreditAttribution: YesCT commentedcross posted with Gabor.
Needs work to make the view be created in the site default language.
Comment #23
Gábor HojtsyNot specified and not applicable does not apply to config that has human text, that just cannot be paired I think (they don't apply to vocabularies either for example I believe). The other magic languages from the content type config screen pictured does not apply because they relate to what instances created would inherit. For a view instance, that kind of setting does not make sense either.
Comment #24
dawehnerLet's do that.
Comment #25
Gábor HojtsyCan we add a test condition that before the langcode was edited to fr, it was language_default()->langcode?
Comment #26
dawehnerThat's indeed a good idea.
Added a general test for wizard plugin base.
Comment #27
Gábor HojtsyLooks good, except:
Why do you need these? It seems unrelated?!
Comment #28
dawehnerWell yeah, the views_fetch_fields() method is part of admin.inc, so you have to include it. As a wizard should work without external setup,
I think these lines make sense here.
Alternative it would be for sure also possible to just include the file in the test, but this feels worse.
Comment #29
Gábor HojtsyBut there is no added views_fetch_fields(), it is pre-existing code?!
Comment #30
Gábor HojtsyRerolled without those two suspicious hunks, let's see testbot!
Comment #32
Gábor HojtsyThere is no views.view.frontpage.yml anymore, so that hunk did not apply. Rerolling by not attempting to touch that nonexistent file :)
Comment #34
Gábor HojtsyIndeed, we need to include those admin.inc files, looking at the fail in the views wizard. So I missed that. Rolling it back. So the only change from #26 (from @dawehner's last version) is that frontpage.yml is not anymore in core / in the patch.
Comment #35
dawehnerWell, there for sure is one :)
http://api.drupal.org/api/drupal/core%21modules%21views%21views_ui%21adm...
Comment #36
Gábor HojtsyReviewing at sprintweekend.
Comment #37
thamas1. Installed D8 from fresh git clone (in English)
2. Added Configuartion inspector module
3. Enabled the Language, Interface translation, Content translation and Configuration inspector modules
4. Added a new language (Hungarian)
5. Applied the patch from #1935022-35: Add a language selector on views
6. Created a new view
7. Inspected the yml file of the view. It has
'langcode' => 'en',
in it, which means the default language of the site.I think we are OK. :)
Comment #38
thamasComment #39
Gábor HojtsyActually the front page one was moved to node config. It still needs the same change.
Comment #40
dawehnerOh right.
Comment #41
saltednutPerhaps langcode and status should be at the top of the file, as in other files?
Otherwise, if no standard is defined, this looks like its good to go.
Comment #42
dawehnerYeah that's a good idea.
In general it seems to be that we want to move the entity ID to the top as well, but sure this is out of the scope of this issue.
Comment #43
damiankloip CreditAttribution: damiankloip commentedLooks super to me now.
Comment #44
saltednutFollowing steps from #37 one more time - more or less.
1. Apply patch #42
2. Install in English
3. Enable the Language, Interface translation, Content translation and Configuration inspector extensions
4. Added additional language (Czech)
5. Created test view. (yml output below)
6. Langcode 'en' is appended to the end of the file.
This looks RTBC to me.
Agreed.
Comment #45
Gábor HojtsyAs YesCT pointed out above, the order of the keys in the files re-exported is not the same as is now, but that is true for many existing keys. She wanted to opne an issue for it. Either way, it is a pre-existing problem.
+1 to RTBC!
Comment #46
YesCT CreditAttribution: YesCT commentedfollow-up for #16 and #44: #1938570: Make views active config save format match the default yml file (order and quotes)
follow-up for #21 #1938576: Tags and Language setting not discoverable under "edit view name/description" button
I'll add to the summary.
Comment #46.0
YesCT CreditAttribution: YesCT commentedadded follow-up section and issues
Comment #47
webchickAwesome!!
Committed and pushed to 8.x. Thanks!
Comment #48
Gábor HojtsyThanks all! Moving off of the D8MI sprint.
We'll need the same feature on menu config entities and possibly contact config entities. Will open issues on that too. Those are the items we identified in Budapest when doing the D8MI inventory on sprint weekend (https://docs.google.com/a/acquia.com/spreadsheet/ccc?key=0Aj6aNMguSdHCdH...).
Comment #49
klonosI really think we should show the language select menu and the tag field on the view create form. I don't buy the reasoning behind the explanation in #21. What used to be an easy thing to do in D7 requires at least two extra clicks in D8 and is hidden behind a button that doesn't provide any hint these settings can be configured there.
Comment #50
dawehnerI understand that there might be use-cases in which you want to configure a lot of different views in different languages, but even for a multilingual page I think using the site default language will work in most cases. Additional your point that this was easier in D7 feels wrong. At least I don't know of a place on the add views formular where you can configure the language?
Comment #51
klonos...the "easy thing in D7" was meant for the views tag only.
Comment #52
dawehnerOh you talk about D6. In general I don't think that having a tag exposed primarily helps anyone.
Comment #53
Gábor HojtsyAdded #1945226: Add language selector on menus which should be a relatively easy one to take following on from this one. Who wants to take that?
Comment #54.0
(not verified) CreditAttribution: commentedfixed typo