This feature request came up from a client.

version 2x beta (2 patches)

  • Added new language negotiation parameters (stored in strongarm) and new logic for wetkit_language.module
  • as well as a minor fix for page.vars.php
  • drush fr wetkit_language -y #(prior to testing)

version 1x beta (1 patch) (BACKPORTED)

  • one patch for wetkit_language
  • drush fr wetkit_language -y #(prior to testing)

Instructions:

  • To test these patches you must apply them and then run a features revert on wetkit_language
  • (makes sure the strongarm variables and new configuration are reloaded from code (otherwise it won't work properly or might give you a white screen)).

This works with 2 languages and it has also been tested with up to 3 languages and should work with more. During qa testing I added Deutch as a third language to make sure it works properly and of course it's tested to work with the default languages

important notes:

  • The language separation language switching is enabled for those with admin menu access only.
  • I'll have to run a few more tests anonymous or unauthenticated user language switching but it should work

Comments

joseph.olstad’s picture

This is a working prototype.

Known issues: when using wetkit_ember as the administration theme the breadcrumbs come out with double lang code prefix

workaround:
1) go to: admin/appearance
2) uncheck the last checkbox at the bottom of the screen, save configuration

joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Title: separate interface and content language » separate interface and content language switching
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

elaborating on the installation instructions

distro 1x:

  1. install wetkit distro v1.7
  2. cd *yoursite_folder*/profiles/wetkit/modules/custom/wetkit_language
  3. wget https://www.drupal.org/files/issues/wetkit_language_1xBETA_separate_inte...
  4. patch -p1 < wetkit_language_1xBETA_separate_interface_and_content_language-2353119-18.patch
  5. drush fr wetkit_language -y

distro 2x:

  1. install wetkit distro v2x
  2. cd *yoursite_folder*/profiles/wetkit/modules/custom/wetkit_language
  3. wget https://www.drupal.org/files/issues/wetkit_language_2xBETA_separate_inte...
  4. patch -p1 < wetkit_language_2xBETA_separate_interface_and_content_language-2353119-19.patch
  5. drush fr wetkit_language -y
  6. cd *yoursite_folder*/profiles/wetkit/themes/wetkit_bootstrap
  7. wget https://www.drupal.org/files/issues/wetkit_bootstrap_separate_interface_...
  8. patch -p1 < wetkit_bootstrap_separate_interface_and_content_language-2353119-10.patch
joseph.olstad’s picture

update patch for wetkit_bootstrap as previous one no longer applies to latest dev build

joseph.olstad’s picture

first patches for wetkit_language threw warning message in 1x and 2x.

This fixes that warning for both 1x and 2x

joel_osc’s picture

It would be great if this issue had a description, and also I don't think the patch adheres to Drupal coding standards. Without these two things I don't think this will get very far.

joseph.olstad’s picture

joel_osc ,
The description: seperate interface and content language switching.

Seems pretty straight forward but I'll elaborate.

Workers may wish to exercise their language preference in the work environment.

This means that the current configuration would have to be altered.

Scenario A) François would like to do his work in french, including creation of english content while maintaining his language preference of French throughout the content editing and publishing process.

Scenario B) Frank would like to do his work in english, including creation of french content while maintaining his language preference of English throughout the content editing and publishing process.

what this patch does is allow this. In fact it also allows you to keep the drupal interface language in Deutch while you're submitting spanish content. It works with X number of languages, can switch separately content and /or interface language .

Scenario C)
This can be helpful if you're going to be working in Arabic content where the language is right to left , say you don't have a clue how to spell anything in arabic and your drupal interface is configured for arabic but you have to paste some content in given to you by someone else because the arabic speaking person that usually posts content in drupal is sick and you want your interface language to stay in your preferred language because otherwise you're struggling with arabic interface labels. Foreign affaires for example has many federal govt of Canada websites that have more than just english and french languages.

I had the priviledge to review quite a few Foreign Affaires web sites and web applications and they weren't all just english and french, some had arabic and other languages.

Also, if say Belgium (another officially bilingual country (Dutch/French ) decides to use the wetkit distribution then they might want this functionality as well. Switzerland has 3 or 4 languages, French/German/Italian/English and they often have people that work with only 2 of those languages so users will want to keep the interface language likely in the 2 languages they know and be able to publish content in the other 2 languages they don't know and it's very likely that their interface language will have translations for all 4 languages.

Description on how to use:
See the comment#9 on installation , follow these steps
log in as an administrator,
see the new links at the top right of the screen, it will say interface then the language beside it followed by content and the language, these links will appear for each language that is added to drupal languages. I've tested with French, German and English as well as just French and English and it works nicely.

joel_osc’s picture

Thanks, that's great - this should really be in the description of the issue to make it clearer to others in the community what this issue is about and perhaps rally some support for this to be added into the distro. That being said, with the code non-conformant this would still not be possible and it would be a good idea to have an on/off switch too.

joseph.olstad’s picture

Ok, let me be more clear:
This is not intended to go in the distro in it's current state.

This is a prototype for something our client is reviewing. Feel free to do whatever you want with the code, as is the usual case with open source software. This is subject to the GPL v2 license agreement according to drupal.org terms and conditions.

It may at some point be elaborated, and we may have to make a push for this to go into the distro.

I can tell you right now, that if drupal is going to thoroughly win the GoC from a-to-z, at some point this issue will come up as to comply with the official languages act a federal employee in a bilingual zone has the right to ask for and demand that the computer tools operate in his or her preferred language. Currently this is not the case, as by default users are forced to work in either french or english interface when editing or publishing content.

Joel_osc, if you could be so kind as to publish your side-by-side e/f language editing this would be an even better solution to allow content moderation to happen in the preferred language. You and I know of at least one organization that has implemented this successfully in both Drupal 6 and Drupal 7. It would be nice to see such a thing be added to the wetkit distro however this issue is about the content/interface language switching prototype , not the dual language E/F side-by-side editor. Please open a new issue for the dual language E/F splitting and add your prototype to it.

I've flagged this issue for "needs review" because it is currently in review state , our client is going to review it, and I thought it would be nice to share this with the community in case someone else wanted to review it. So far all I'm hearing from your comments is non conformant, what exactly is non-conformant? what exactly is not drupal standards? Can you please be a little more specific in your concerns? Is it code syntax / character spacing you're referring to (easily solved by using coder review) or is it functional compliance that you're referring to?

Thanks

joel_osc’s picture

Title: separate interface and content language switching » Separate interface and content language switching
Status: Needs review » Needs work

I am interested in this functionality as I have had a few clients mention it as well, which is why I reviewed the patch - something I always do prior to testing it. Unfortunately, there were so many issues with the code syntax that I don't believe it is ready for testing. I think it would be best if you went through and cleaned up the patch prior to further review, please reference https://www.drupal.org/coding-standards for structure, variable naming, etc.

As for translations, I would recommend this awesome module: https://www.drupal.org/project/tmgmt

Thanks.

joseph.olstad’s picture

Hi Joel_osc, thanks for the specifics. I've installed coder_review, coder, gplib and coder_upgrade ,
I'll run a review of this code after lunch.

Thanks

joseph.olstad’s picture

Hi Joel_osc, you'll be pleased.

Here's the new 1x BETA patch after running:

  • Drupal CodeSniffer (Optional; Checks for PHP Coder_Sniffer rules.)
  • Drupal Coding Standards (Checks for Drupal coding standards. Every developer should use this.)
  • Drupal Commenting Standards (Checks for the Drupal commenting standards; every developer should use this.)
  • Drupal Security Checks (Checks for security issues. This is a very basic security check. It errs on the side of caution so may give false positives.)
  • Drupl'Art Coding Style (Optional; Checks for coding style suggested by the author.)
  • Internationalization
  • Release standards (Prepare modules for production by removing debugging function calls.)

What I'd like from you now is to review the 1x patch for wetkit_language.

I just tested it with Deutch, Italiano, French, English, and it behaves as designed, if you're in Italiano, the option to switch to Italiano is replaced with the language you just switched from. Links for content and interface language switch are shown and work respectively. I've tested it when loading deutch po files as well as french po files and creating test deutch and test french content as well.

What needs to be done: Make the interface prettier, put flags that represent the old countries that made these languages famous. I think there actually is a language icon module but it'd have to be modified to work with wetkit_language and have to be modified for interface icon and content icon.

What else needs to be done: more reviews.

joseph.olstad’s picture

Status: Needs work » Needs review

a 1x version is available for review in comment #18. I will provide a new 2x patch shortly.

joseph.olstad’s picture

joseph.olstad’s picture

Joel_osc, I ran the code through coder_upgrade which fixed some things automatically then I ran coder review and went through the coder review suggestions one by one until they dissappeared. Then retested the code in a working environment and it looks good.

As time permits I'll run coder_review more often.

I appreciate your feedback and look forward to your reviews.

Thanks

joseph.olstad’s picture

Status: Needs review » Active
StatusFileSize
new1.84 KB
new1.49 KB

I have an idea for a more graphical/easier to understand interface for this.

Here's a mockup:

icon with linked chain to indicate same interface and content language
attaché_vers_alpha_petit.png FR
attaché_vers_alpha_petit.png EN

icon with broken link in chain to indicate seperate interface and seperate content language
détaché_vers_alpha_petit.png FR interface content

then put the language code beside the icon, alternate icon display depending on selection and alternate display as needed. so icon FR , icon EN, icon DE
when clicked the chain to unlink break it out into two new icons, (suggestions for look are welcome?)

joseph.olstad’s picture

The design of this functionality has been re-thought after a quick brainstorming session.

It was suggested that the option to select interface language be moved into the "leaf" pullout menu in the 2x version of the distro for example. The other language option will remain english OR french, but I'll try to make sure that this logic will not break if there's more than two languages keeping a simple straight forward interface.

Some reworking of the logic is required to ensure that non priviledges/non-authenticated users cannot separate the interface language when this functionality is enabled.

The limitation of this functionality is that the mega menus act as if they are interface, not content. All entity related content behaves as content language but mega menus will exhibit the interface language choice. This makes sense because of the way the menus are implemented in a non-entity way (desireable when we want menu link item weights to be independant of language as is usually the case).

It's likely we're going to delay implementing this for quite a few months however it's good to plan now and we'll probably do some more proof of concepts, /prototyping of this idea as it's apparently still something our client wants and expects.

I'd like to get a new prototype/iteration out with the new idea, my next prototype/iteration would only be for the 2x branch but could be backported if necessary.

sylus’s picture

Status: Active » Postponed
sylus’s picture

Status: Postponed » Closed (won't fix)

I am going to close this issue for now. Ideally this would be solved in a contrib module. Once there is a contrib module that can do this I can rewrite the language switcher to use an alter invocation so wetkit_language can be overridden by any contrib module.

Once a contrib module exists that satisfies this use case we can look at this further.

joseph.olstad’s picture

Status: Closed (won't fix) » Postponed

There already is a contrib module that does this and we're currently using it however we've configured it for admin interface and content language to be the same. This is both a configuration issue (settings stored in wetkit_language.strongarm.inc ) and an interface issue (current behaviour is programmed in wetkit_language.module). Our interface puts the language link as either english or français depending on what the current language is. What my patch does/did is allow for a link to change interface language and also content language (separating the two). At the same time our current wetkit_language module has a limitation in that the link is either english or français, that's why I had to enhance the logic to make it handle english admin français content and vice versa or the same. This is an interface issue and no contrib module will magically solve this because our custom wetkit_language module defines the configuration that results in the current behaviour. To change the behaviour we have to change the wetkit_language module and wetkit_language.strongarm.inc code that stores the settings for admin/config/regional/language/configure .

It was suggested that we might burry the admin interface selection somewhere in the WxT menu under wetkit_language or something and make it a user preference, this can be done as the contrib modules we are currently using support this ( admin/config/regional/language/configure .).

Time needs to be spent to sit down and do a bit more prototyping on this and review this with our stakeholders to see what appeals to them. I did a demo (a while back) already and it was suggested to put the admin interface language selection into say for example the WxT menu under wetkit_language and have it set as user preference. With a bit more testing /dev we could churn something out. Most of the changes required will have to be done to the wetkit_language module. We're already customizing how language switching is done in both the wetkit_language.module file and the wetkit_language.strongarm.inc file that configure admin/config/regional/language/configure . .

The design strategy that this prototyping work has led to now focuses on: make the admin interface language switching either A) a user preference or B) default behaviour. This is specified for us in admin/config/regional/language/configure . However we may want to expand on how the user preference is set. Currently it's set under the users profile (language preference), so that interface already exists. However ideally we'd only want certain roles to be able to do this otherwise use the current language switching scheme. Weighted selection rules are available here: admin/config/regional/language/configure .

It seems our clients haven't yet decided to give up on this but I'm not sure if it's a huge priority right now. If this heats up again we'll reopen this issue and continue work on it. I've heard lots of people request this type of functionality in the past. It would be something worthwhile however I imagine people have gotten used to switching admin interface languages when working on other language content. Maybe we could improve client satisfaction if we can get this done in a way that is very subtle and without causing changes to existing functionality. Add this as an option that you have to select. The problem is is that right now if we enable this everyone will get it based on their current user role language preference whether they want it or not. Some thought will have to be put into it, I'm sure theres a way to make this a subtle addition where it would be explicitly enabled on a user level (once you have a close look at admin/config/regional/language/configure you'll see what I mean).

joseph.olstad’s picture

Version: 7.x-2.x-dev » 7.x-4.x-dev
sylus’s picture

Status: Postponed » Closed (works as designed)

Going to close this issue since overrides are now possible in language_switcher using drupal_alter. This will now allow any developer to change the default behaviour which should only arise in a small subset of use cases.

#2563251: Allow for Language Switcher to use drupal_alter