wrong translation of countries in material's manufacturer & distributors #1953

This commit is contained in:
Bachir Soussi Chiadmi 2022-12-08 10:07:27 +01:00
parent 8ff54a8d14
commit 024cf0e08f
4 changed files with 5 additions and 3 deletions

View File

@ -1293,8 +1293,10 @@ class MaterioSchemaExtension extends SdlSchemaExtensionPluginBase {
$registry->addFieldResolver('Country', 'country_name',
$builder->callback(function ($parent, $args) {
// As company terms are not translated we have to get the current site language instead of parent language
$langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
$cc = $parent[0]['country_code'];
$countries = $this->countryRepository->getList();
$countries = $this->countryRepository->getList($langcode);
$cn = isset($countries[$cc]) ? $countries[$cc] : $cc;
return $cn;
})

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@ import axios from 'axios'
console.log(window.location)
const MGQ = axios.create({
baseURL: window.location.origin + '/mgq',
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix + 'mgq',
withCredentials: true,
headers: {
Accept: 'application/json',