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

Add multilingual support #158

Closed
22 of 30 tasks
Tracked by #416 ...
CarmelClark opened this issue Sep 22, 2020 · 5 comments · Fixed by #422
Closed
22 of 30 tasks
Tracked by #416 ...

Add multilingual support #158

CarmelClark opened this issue Sep 22, 2020 · 5 comments · Fixed by #422
Labels
enhancement New feature or request help wanted Extra attention is needed module: druxt Related to the `druxt` module module: router Related to the `druxt-router` module
Milestone

Comments

@CarmelClark
Copy link

CarmelClark commented Sep 22, 2020

Is your feature request related to a problem? Please describe.
There is no support for the multilingual content provided by the Umami demo.

Describe the solution you'd like

  • DruxtClient support for prefixes or langcodes
    • A node application should be able to request any resource by langcode with a fallback default langcode.
    • createResource (untested)
    • getCollection
    • getCollectionAll
    • getIndex
    • getRelated
    • getResource
    • updateResource (untested)
  • Druxt modules support
  • DruxtStore support for prefixes or langcodes
    • druxt/addResource; resource data is stored against prefix
    • druxt/getResource
    • addCollection
    • getCollection
  • DruxtRouter support for prefixes or langcodes
    • Fetching the route shouldn't need to change, nor should the storage, as the langcode data is provided by the Decoupled Router with patch
      "drupal/decoupled_router": {
        "https://www.drupal.org/project/decoupled_router/issues/3111456#comment-14093342": "https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch"
      }
      
    • Redirects need to work
      • Workaround: Disable router middleware
    • API proxy endpoint for langcode prefixes

Testing (in gitpod)

  1. Open https://gitpod.io/#https://github.com/druxt/druxt.js/pull/422
  2. Wait
  3. cd examples/nuxt/druxt-site && yarn && yarn dev

Describe alternatives you've considered
No

Additional context

@Decipher
Copy link
Member

The JSON:API endpoints already support changing the langcode to get the multilingual resource.

@Decipher
Copy link
Member

Decipher commented Nov 11, 2020

@Decipher Decipher transferred this issue from druxt/druxt.js Mar 13, 2021
@Decipher Decipher transferred this issue from druxt/umami.demo.druxtjs.org Aug 26, 2021
@Decipher Decipher added enhancement New feature or request help wanted Extra attention is needed module: router Related to the `druxt-router` module module: druxt Related to the `druxt` module labels Aug 26, 2021
Decipher referenced this issue in robedwards-cti/druxt.js Aug 26, 2021
@Decipher
Copy link
Member

Looks like you can get a translated version of the entire site (mostly) just by changing the endpoint in the nuxt.js.config:

export default {
  ...
  druxt: {
    baseUrl: 'https://demo-api.druxtjs.org',
    endpoint: '/es/jsonapi'
  }
}

image

@Decipher
Copy link
Member

There's a patch for the Decoupled Router Drupal module related to multi-lingual support: https://www.drupal.org/project/decoupled_router/issues/3111456

Decipher added a commit that referenced this issue Jan 19, 2022
Decipher added a commit that referenced this issue Mar 23, 2022
@Decipher Decipher added this to the 1.0.0 milestone Mar 29, 2022
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 11, 2022
# Conflicts:
#	yarn.lock
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 11, 2022
Decipher added a commit that referenced this issue May 12, 2022
Decipher added a commit that referenced this issue May 12, 2022
Decipher added a commit that referenced this issue May 12, 2022
Decipher added a commit that referenced this issue May 14, 2022
Decipher added a commit that referenced this issue May 15, 2022
Decipher added a commit that referenced this issue May 17, 2022
* feat(#158): add multilingual support

* chore(#158): update multilingual support

* chore(#158): fix linting issues

* chore: add todo

* chore(#158): add multilingual router patch

* feat(#158): add prefix to getCollectionAll

* chore(#158): add multilingual examples

* feat(#158): add prefix support

* chore(#158): add prefix examples

* feat(#158): add prefix support to DruxtStore

* feat(#158): add langcode prop

* chore(#158): fix to stop error if missing data

* chore: update gitpod setup

* chore(#158): update router prefix support

* chore(#158): update druxt site example config

* feat(#158): add langcode and prefix support

* feat(#158): added langcode and prefix support

* chore(#158): update composer

* chore(#158): add example language block

* chore(#158): add prefix to vuex action

* chore(#158): update multilingual druxt-site

* chore(#158): update decoupled router patch

* chore(#158): update menu multilingual support

* chore(#138): added langcode routes

* chore(#158): update prefix

* chore(#158): update example components

* chore(#158): fix timing issue

* chore(#158): add prefix to collection store

* chore(#158): update router

* chore(#158): add prefix to dehydrateResources

* chore(#158): fix breadcrumb

* feat(#158): add langcode prop to DruxtModule

* feat(#158): add langcode to mixins

* feat(#158): add multilingual support to components

* feat(#158): add multilingual support

* chore(#158): update mulitlingual support

* feat(#158): add langcode component options

* chore(#158): reduce fetch flicker

* chore(#158): update tests

* fix(#158): fix missing langcode issues

* fix(#158): fix flicker refresh issue

* feat(#158): update breadcrumb multilingual support

* fix(#158): fix redirect

* feat(#158): remove prefix before path check

* chore(#158): fix router bloating

# Conflicts:
#	yarn.lock

* feat(#158): add langcode prefix to api proxy

* chore(#158): update getRedirect for langcode

* chore(#158): fix issue with API proxy

* chore(#158): update test coverage

* chore(#158): update client guide for multilingual

* chore(#158): update documentation

* chore(#158): fix langcode suffixed options

* chore(#158): fix breadcrumb block binding

* chore(#158): update component options docs

* chore(#158): add multilingual guide

* chore(#158): add multilingual to readme

* chore(#158): added mulilingual patches

Co-authored-by: Robert Edwards <r.edwards@ctidigital.com>
Co-authored-by: Romain Couturier <rcouturier@wedarecreate.com>
@Decipher Decipher unpinned this issue May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed module: druxt Related to the `druxt` module module: router Related to the `druxt-router` module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants