Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2361 - Add multilingual support #2390

Merged
merged 24 commits into from
May 17, 2023
Merged

Closes #2361 - Add multilingual support #2390

merged 24 commits into from
May 17, 2023

Conversation

akslay
Copy link
Contributor

@akslay akslay commented May 2, 2023

Description

Adds multilingual functionality to QS.

Closes #2361
Review site: https://7b5e2985-cedf-4a13-ab91-3a35916c835d--pr-2390.probo.build/

Documentation has been added here, in addition to the module's README: https://quickstart.arizona.edu/create-content/translating-content?review=GQqaA9fjvtV--KB5sj6zL3wBPc8h6JhfXNPuVo5rk7U

User role changes:

  • content admin can install languages on the site
  • content editor can make content translations

General Additions

  • Defines which entities can be translated
  • Provides styling for language toggle (uses .btn-dark styling to visually differentiate it from normal buttons [red/blue/white] on the site)
  • Overrides the language block template
  • Adds classes directly to link elements within the language block to avoid maintaining CSS overrides

How to test

Enabling the Masquerade module will make testing faster.

As an azadmin:

  1. Enable the az_multilingual module.

As an azcontentadmin:

  1. Install a language on the site.
  2. Place the Language Switcher Block.

As an azcontenteditor:

  1. Create a content translation (as az_content_admin).
  2. Toggle between languages to see the difference.

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
    • Adding experimental module
    • Update experimental module
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Upgrade experimental module to stable
    • Enable existing module by default or database update
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown
    • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown
    • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown
    • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@akslay akslay added enhancement New feature or request 2.7.x only labels May 2, 2023
@akslay
Copy link
Contributor Author

akslay commented May 3, 2023

  • Content editor role should be able to make content translations
  • Need to document the workflow blocker for modifying menu item
  • Possibly remove config in quickstart folder.
  • Remove background color and allow using block class or some other method to add it.

This “needs work” documentation says you can translate the menu?
https://www.drupal.org/docs/multilingual-guide/menu-translation-in-drupal-8

@trackleft trackleft added the documentation Improvements or additions to documentation label May 3, 2023
@trackleft
Copy link
Member

Overall, I think this looks good and will be a great addition to quickstart.

@akslay akslay marked this pull request as ready for review May 10, 2023 14:11
@akslay akslay requested a review from a team as a code owner May 10, 2023 14:11
@akslay
Copy link
Contributor Author

akslay commented May 10, 2023

Per the last meeting, we have chosen to enable the Splitscreen module by default, which also eliminates the dependency issue upon install of az_multilingual.

@trackleft
Copy link
Member

Have you seen this issue: https://www.drupal.org/project/linkit/issues/2886455

akslay and others added 2 commits May 10, 2023 10:25
Content admin role is additive

Co-authored-by: Chris Green <[email protected]>
joeparsons
joeparsons previously approved these changes May 10, 2023
…_settings.paragraph.az_contact.yml

Co-authored-by: Chris Green <[email protected]>
@akslay
Copy link
Contributor Author

akslay commented May 11, 2023

It looks like the translations are not working correctly on our custom field types (cards and accordions). There is no differentiation between the 2 versions, and the most recent edit is instead used for all translations. I would consider this a blocker for this PR.

It also looks like the YML files are not capturing all of the configuration set for a given content type. For example, on the Page content type, I only had the following options enabled for translations:
Screenshot 2023-05-11 at 11 42 25 AM

However, different options are enabled and disabled upon a fresh install of the Quickstart Multilingual module:
Screenshot 2023-05-11 at 11 42 36 AM

Looking at the YML files for each content type, these individual checkboxes/configuration options aren't even included in the YML file, so I'm not sure how to ensure the configuration gets captured. I don't see any other config files within Config Sync/Export that would have captured that configuration either.

@tadean
Copy link
Contributor

tadean commented May 12, 2023

It looks like the translations are not working correctly on our custom field types (cards and accordions). There is no differentiation between the 2 versions, and the most recent edit is instead used for all translations. I would consider this a blocker for this PR.

In some testing locally it looks like cards do work with translations when configured by hand - it looks like the issue may be similar to what you noticed about the page content type, where some information about selected fields isn't seemingly represented in the yml files maybe...

@akslay
Copy link
Contributor Author

akslay commented May 12, 2023

@trackleft
Copy link
Member

Tested this on the quickstart.arizona.edu website as a pantheon multi-dev from the live version.
The live version was on 2.6.3

Here is the result.
image

+------------+-------------------------------------------------------------------+-----------+
| Collection | Config                                                            | Operation |
+------------+-------------------------------------------------------------------+-----------+
|            | filter.format.basic_html                                          | Update    |
|            | image.style.linkit_result_thumbnail                               | Update    |
|            | filter.format.az_standard                                         | Update    |
|            | linkit.linkit_profile.default                                     | Update    |
|            | field.field.node.az_carousel_item.field_az_carousel_short_summary | Update    |
|            | field.field.node.az_event.field_az_trellis_id                     | Update    |
|            | field.field.node.az_event.field_az_photos                         | Update    |
|            | field.field.node.az_event.field_az_location                       | Update    |
|            | field.field.node.az_event.field_az_link                           | Update    |
|            | field.field.node.az_flexible_page.field_az_metatag                | Update    |
|            | field.field.node.az_news.field_az_short_title                     | Update    |
|            | field.field.node.az_news.field_az_published                       | Update    |
|            | field.field.node.az_news.field_az_media_image                     | Update    |
|            | field.field.node.az_news.field_az_expiration_date                 | Update    |
|            | field.field.node.az_news.field_az_byline                          | Update    |
|            | field.field.node.az_news.field_az_attachments                     | Update    |
|            | field.field.node.az_person.field_az_titles                        | Update    |
|            | field.field.node.az_person.field_az_pronouns                      | Update    |
|            | field.field.node.az_person.field_az_media_image                   | Update    |
|            | field.field.node.az_person.field_az_lname                         | Update    |
|            | field.field.node.az_person.field_az_links                         | Update    |
|            | field.field.node.az_person.field_az_fname                         | Update    |
|            | field.field.node.az_person.field_az_email                         | Update    |
|            | field.field.node.az_person.field_az_degrees                       | Update    |
|            | field.field.node.az_person.field_az_attachments                   | Update    |
|            | field.field.node.az_flexible_page.field_az_marketing_page_style   | Update    |
|            | field.field.paragraph.az_accordion.field_az_accordion             | Update    |
|            | field.field.paragraph.az_cards.field_az_cards                     | Update    |
|            | field.field.paragraph.az_contact.field_az_email                   | Update    |
|            | field.field.node.az_news.field_az_contacts                        | Update    |
|            | field.field.paragraph.az_photo_gallery.field_az_photos            | Update    |
|            | field.field.paragraph.az_text_media.field_az_title                | Update    |
|            | field.field.paragraph.az_text_media.field_az_media                | Update    |
|            | core.entity_form_display.media.az_document.default                | Update    |
|            | field.field.node.az_event.field_az_event_date                     | Update    |
|            | field.field.node.az_event.field_az_event_category                 | Update    |
|            | field.field.node.az_news.field_az_news_tags                       | Update    |
|            | field.field.node.az_flexible_page.field_az_page_category          | Update    |
|            | field.field.node.az_person.field_az_person_category               | Update    |
|            | field.field.node.az_person.field_az_person_category_sec           | Update    |
|            | field.field.paragraph.az_contact.field_az_phone                   | Update    |
|            | field.field.node.az_person.field_az_phones                        | Update    |
|            | field.field.paragraph.az_text.field_az_text_area                  | Update    |
|            | field.field.paragraph.az_html.field_az_full_html                  | Update    |
|            | field.field.node.az_person.field_az_body                          | Update    |
|            | field.field.node.az_person.field_az_address                       | Update    |
|            | field.field.node.az_news.field_az_subheading                      | Update    |
|            | field.field.node.az_news.field_az_body                            | Update    |
|            | field.field.node.az_event.field_az_summary                        | Update    |
|            | field.field.node.az_event.field_az_body                           | Update    |
|            | field.field.media.az_image.field_az_credit                        | Update    |
|            | field.field.media.az_image.field_az_caption                       | Update    |
|            | field.field.paragraph.az_view_reference.field_az_view_reference   | Update    |
+------------+-------------------------------------------------------------------+-----------+

After enabling the module, I got this.

image
And this
image

Then I enabled the "Language switcher" block and added it to the Content top region.

image

After that, I began translating the front page to Spanish.

But got the fun error about using links that I don't have access to.

image

This error was in reference to cards, which I didn't know, and Ashley revealed to me.

I was initially confused because I hadn't edited those links. However, once I knew what the issue was, I was able to quickly get around it by editing those links.

I think it could be considered a feature, if instead of erroring because of access, it said that there is not a Spanish translation for those pages.

@trackleft
Copy link
Member

image

Copy link
Contributor

@bberndt-uaz bberndt-uaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some quick testing on a Pantheon multidev and did not encounter any issues.

@joeparsons joeparsons merged commit 2612577 into main May 17, 2023
@joeparsons joeparsons deleted the issue/2361 branch May 17, 2023 17:17
@trackleft trackleft mentioned this pull request Jun 16, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.7.x only documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add multilingual support
5 participants