-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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>
- Loading branch information
1 parent
5514fa3
commit be21952
Showing
90 changed files
with
2,890 additions
and
1,186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt": minor | ||
--- | ||
|
||
Added language prefixes to API proxy support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-router": minor | ||
--- | ||
|
||
Added langcode support to the DruxtRouter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-blocks": minor | ||
--- | ||
|
||
Added multilingual support to the DruxtBlock and DruxtBlockRegion component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-menu": minor | ||
--- | ||
|
||
Added multilingual support to the DruxtMenu component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-blocks": minor | ||
--- | ||
|
||
Add support for multilingual paths in DruxtBlockRegion. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-entity": minor | ||
--- | ||
|
||
Added **langcode** prop to DruxtEntity and DruxtField components for multilingual support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"druxt-blocks": minor | ||
"druxt-breadcrumb": minor | ||
"druxt-entity": minor | ||
"druxt-menu": minor | ||
"druxt-router": minor | ||
"druxt-site": minor | ||
"druxt-views": minor | ||
--- | ||
|
||
Added langcode to component mixins. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt": minor | ||
--- | ||
|
||
Added multilingual support to the base DruxtModule component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt": minor | ||
--- | ||
|
||
Added langcode prefix support to the DruxtStore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"druxt-breadcrumb": minor | ||
"druxt-menu": minor | ||
"druxt-views": minor | ||
--- | ||
|
||
Added multilingual support to Block components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt": minor | ||
--- | ||
|
||
Added langcode suffixed component options for multilingual templates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-breadcrumb": minor | ||
--- | ||
|
||
Removed duplicate Home crumb when using a multilingual backend. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"druxt-views": minor | ||
--- | ||
|
||
Added langcode and prefix support to DruxtView component and Vuex store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
title: Multilingual content | ||
weight: -5 | ||
--- | ||
|
||
# Multilingual content | ||
|
||
Druxt has support for multilingual content in all modules and in various forms: | ||
- The DruxtClient and Store can fetch translated resources and collections | ||
- Druxt module components can specify language with the **langcode** prop | ||
- Theming can be done in language specific components | ||
|
||
* * * | ||
|
||
## Getting started | ||
|
||
The following Drupal patches are required to enable multilingual content in the JSON:API: | ||
|
||
- Decoupled Router: | ||
- Issue: https://www.drupal.org/project/decoupled_router/issues/3111456 | ||
- Patch: https://git.drupalcode.org/project/decoupled_router/-/merge_requests/5.diff | ||
|
||
- Druxt (Decoupled View routes): | ||
- Issue: https://www.drupal.org/project/druxt/issues/3273228 | ||
- Patch: https://git.drupalcode.org/project/druxt/-/merge_requests/9.diff | ||
|
||
- JSON:API Menu Items: | ||
- Issue: https://www.drupal.org/project/jsonapi_menu_items/issues/3192576 | ||
- Patch: https://git.drupalcode.org/project/jsonapi_menu_items/-/merge_requests/7.diff | ||
|
||
### tl;dr | ||
|
||
Add the following to your composer.json patches: | ||
```json | ||
"drupal/druxt": { | ||
"https://www.drupal.org/project/druxt/issues/3273228": "https://git.drupalcode.org/project/druxt/-/merge_requests/9.diff" | ||
}, | ||
"drupal/decoupled_router": { | ||
"https://www.drupal.org/project/decoupled_router/issues/3111456#comment-14093342": "https://git.drupalcode.org/project/decoupled_router/-/merge_requests/5.diff" | ||
}, | ||
"drupal/jsonapi_menu_items": { | ||
"https://www.drupal.org/project/jsonapi_menu_items/issues/3192576#comment-14473856": "https://git.drupalcode.org/project/jsonapi_menu_items/-/merge_requests/7.diff" | ||
} | ||
``` | ||
|
||
* * * | ||
|
||
## Fetching a translated resource | ||
|
||
All DruxtClient and DruxtStore methods and actions have support for a langcode prefix, falling back to the default language, as determined by the Drupal backend. | ||
|
||
_Example: Fetching a spanish recipe from the DruxtStore_ | ||
|
||
```js | ||
this.$store.dispatch('druxt/getResource', { | ||
type: 'node--page', | ||
id: 'd8dfd355-7f2f-4fc3-a149-288e4e293bdd', | ||
prefix: 'es' | ||
}) | ||
``` | ||
|
||
- See the [DruxtClient](/api/packages/druxt/client) and [DruxtStore](/api/packages/druxt/stores/druxt) API docs. | ||
|
||
* * * | ||
|
||
## Langcode prop | ||
|
||
DruxtModule components have a **langcode** prop to specify the language, as well as a computed **lang** prop containing the fallback languge if no langcode prop is provided. | ||
|
||
_Example: Rendering a DruxtEntity component in spanish_ | ||
|
||
```jsx | ||
<DruxtEntity | ||
type="node--page" | ||
id="d8dfd355-7f2f-4fc3-a149-288e4e293bdd" | ||
langcode="es" | ||
/> | ||
``` | ||
|
||
- See the [DruxtModule](/api/packages/druxt/components/DruxtModule) component documentation. | ||
|
||
* * * | ||
|
||
## Language theme components | ||
|
||
All Druxt modules provide language specific theme component options, allowing for language specific customisations. | ||
|
||
_Example: `~/components/druxt/entity/node/page/Es.vue`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Proxy | ||
weight: -5 | ||
weight: -4 | ||
--- | ||
|
||
### Druxt and Proxies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.