From 788f00a603d0698aa43d3fe268d4f44aa00899bf Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 14 Nov 2024 12:14:14 +0100 Subject: [PATCH 1/4] map translation --- .../custom/q2d_mod/src/Plugin/Block/SitesMap.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php b/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php index fcd1444..18ef0be 100644 --- a/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php +++ b/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php @@ -21,6 +21,8 @@ class SitesMap extends BlockBase { * {@inheritdoc} */ public function build() { + $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); + $return = null; $allSites = \Drupal::entityTypeManager()->getStorage('node') @@ -39,12 +41,14 @@ class SitesMap extends BlockBase { foreach($allSites as $index => $site){ - $title = $site->get('title')->getString(); - $subtitle = $site->get('field_sous_titre')->getString(); + // $title = $site->get('title')->getString(); + $title = $site->hasTranslation($language) ? $site->getTranslation($language)->get('title')->getString() : $site->get('title')->getString(); + // $subtitle = $site->get('field_sous_titre')->getString(); + $subtitle = $site->hasTranslation($language) ? $site->getTranslation($language)->get('field_sous_titre')->getString() : $site->get('field_sous_titre')->getString(); $link_options = ['absolute' => TRUE, 'attributes' => ['class' => 'site-link']]; // Passer 'absolute' à TRUE $site_url = $site->toUrl('canonical', $link_options)->toString(); // URL absolue pour le data-url - $site_link_object = Link::createFromRoute("voir le site", 'entity.node.canonical', ['node' => $site->id()], $link_options); + $site_link_object = Link::createFromRoute(t("got to site"), 'entity.node.canonical', ['node' => $site->id()], $link_options); $link = $site_link_object->toString()->getGeneratedLink(); $datacontent = htmlspecialchars("$title
$subtitle
$link"); From c688ee2b9e4353fdbcbaed80e30ea5a906abbb47 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 14 Nov 2024 12:18:34 +0100 Subject: [PATCH 2/4] site info translation --- .../language/en/field.field.node.site.field_departement_s.yml | 1 + .../field.field.node.site.field_nom_de_la_commune_nb_d_hab.yml | 1 + .../en/field.field.node.site.field_nom_du_qpv_nb_d_hab.yml | 1 + .../en/field.field.node.site.field_porteur_s_de_site.yml | 1 + .../en/field.field.node.site.field_programme_de_l_etat.yml | 1 + config/sync/language/en/field.field.node.site.field_region.yml | 1 + 6 files changed, 6 insertions(+) create mode 100644 config/sync/language/en/field.field.node.site.field_departement_s.yml create mode 100644 config/sync/language/en/field.field.node.site.field_nom_de_la_commune_nb_d_hab.yml create mode 100644 config/sync/language/en/field.field.node.site.field_nom_du_qpv_nb_d_hab.yml create mode 100644 config/sync/language/en/field.field.node.site.field_porteur_s_de_site.yml create mode 100644 config/sync/language/en/field.field.node.site.field_programme_de_l_etat.yml create mode 100644 config/sync/language/en/field.field.node.site.field_region.yml diff --git a/config/sync/language/en/field.field.node.site.field_departement_s.yml b/config/sync/language/en/field.field.node.site.field_departement_s.yml new file mode 100644 index 0000000..8dc2b2a --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_departement_s.yml @@ -0,0 +1 @@ +description: Department(s) diff --git a/config/sync/language/en/field.field.node.site.field_nom_de_la_commune_nb_d_hab.yml b/config/sync/language/en/field.field.node.site.field_nom_de_la_commune_nb_d_hab.yml new file mode 100644 index 0000000..dc01883 --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_nom_de_la_commune_nb_d_hab.yml @@ -0,0 +1 @@ +label: 'Name of the municipality (population)' diff --git a/config/sync/language/en/field.field.node.site.field_nom_du_qpv_nb_d_hab.yml b/config/sync/language/en/field.field.node.site.field_nom_du_qpv_nb_d_hab.yml new file mode 100644 index 0000000..5d0dc23 --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_nom_du_qpv_nb_d_hab.yml @@ -0,0 +1 @@ +label: 'Name of the priority urban neighborhood (population)' diff --git a/config/sync/language/en/field.field.node.site.field_porteur_s_de_site.yml b/config/sync/language/en/field.field.node.site.field_porteur_s_de_site.yml new file mode 100644 index 0000000..3133dca --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_porteur_s_de_site.yml @@ -0,0 +1 @@ +label: 'Contracting authority' diff --git a/config/sync/language/en/field.field.node.site.field_programme_de_l_etat.yml b/config/sync/language/en/field.field.node.site.field_programme_de_l_etat.yml new file mode 100644 index 0000000..4a871f4 --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_programme_de_l_etat.yml @@ -0,0 +1 @@ +description: 'State programmes' diff --git a/config/sync/language/en/field.field.node.site.field_region.yml b/config/sync/language/en/field.field.node.site.field_region.yml new file mode 100644 index 0000000..48ae7e4 --- /dev/null +++ b/config/sync/language/en/field.field.node.site.field_region.yml @@ -0,0 +1 @@ +label: Region(s) From 4d21ad7a92bda48e7a7f07f49fe9174e10a0e5b7 Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 14 Nov 2024 12:21:48 +0100 Subject: [PATCH 3/4] actus view title translation --- config/sync/language/en/views.view.actus.yml | 4 ++++ config/sync/views.view.actus.yml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 config/sync/language/en/views.view.actus.yml diff --git a/config/sync/language/en/views.view.actus.yml b/config/sync/language/en/views.view.actus.yml new file mode 100644 index 0000000..e4f7687 --- /dev/null +++ b/config/sync/language/en/views.view.actus.yml @@ -0,0 +1,4 @@ +display: + default: + display_options: + title: Actualities diff --git a/config/sync/views.view.actus.yml b/config/sync/views.view.actus.yml index 209af72..9cbd3e0 100644 --- a/config/sync/views.view.actus.yml +++ b/config/sync/views.view.actus.yml @@ -144,7 +144,7 @@ display: options: query_comment: '' disable_sql_rewrite: false - distinct: false + distinct: true replica: false query_tags: { } relationships: { } From c82fea24b732401837d06c08af2020127c9da7cc Mon Sep 17 00:00:00 2001 From: bach Date: Thu, 14 Nov 2024 12:23:50 +0100 Subject: [PATCH 4/4] actus translation --- ...core.base_field_override.node.actualite.menu_link.yml | 2 +- .../core.base_field_override.node.actualite.metatag.yml | 2 +- .../core.base_field_override.node.actualite.title.yml | 2 +- config/sync/field.field.node.actualite.body.yml | 2 +- .../sync/field.field.node.actualite.field_fichiers.yml | 2 +- config/sync/field.field.node.actualite.field_images.yml | 9 ++++++++- config/sync/field.field.node.actualite.field_liens.yml | 2 +- config/sync/language.content_settings.node.actualite.yml | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/config/sync/core.base_field_override.node.actualite.menu_link.yml b/config/sync/core.base_field_override.node.actualite.menu_link.yml index 9dd82e3..2eca4e2 100644 --- a/config/sync/core.base_field_override.node.actualite.menu_link.yml +++ b/config/sync/core.base_field_override.node.actualite.menu_link.yml @@ -11,7 +11,7 @@ bundle: actualite label: 'Menu link' description: 'Computed menu link for the node (only available during node saving).' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: diff --git a/config/sync/core.base_field_override.node.actualite.metatag.yml b/config/sync/core.base_field_override.node.actualite.metatag.yml index 5d091d8..80aea0e 100644 --- a/config/sync/core.base_field_override.node.actualite.metatag.yml +++ b/config/sync/core.base_field_override.node.actualite.metatag.yml @@ -13,7 +13,7 @@ bundle: actualite label: 'Metatags (Hidden field for JSON support)' description: 'The computed meta tags for the entity.' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: { } diff --git a/config/sync/core.base_field_override.node.actualite.title.yml b/config/sync/core.base_field_override.node.actualite.title.yml index 7063da5..c41700a 100644 --- a/config/sync/core.base_field_override.node.actualite.title.yml +++ b/config/sync/core.base_field_override.node.actualite.title.yml @@ -11,7 +11,7 @@ bundle: actualite label: Title description: '' required: true -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: { } diff --git a/config/sync/field.field.node.actualite.body.yml b/config/sync/field.field.node.actualite.body.yml index 93ce1b4..d7fce54 100644 --- a/config/sync/field.field.node.actualite.body.yml +++ b/config/sync/field.field.node.actualite.body.yml @@ -14,7 +14,7 @@ bundle: actualite label: Body description: '' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: diff --git a/config/sync/field.field.node.actualite.field_fichiers.yml b/config/sync/field.field.node.actualite.field_fichiers.yml index fe348ed..99d5082 100644 --- a/config/sync/field.field.node.actualite.field_fichiers.yml +++ b/config/sync/field.field.node.actualite.field_fichiers.yml @@ -14,7 +14,7 @@ bundle: actualite label: Fichiers description: '' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: diff --git a/config/sync/field.field.node.actualite.field_images.yml b/config/sync/field.field.node.actualite.field_images.yml index 8420788..f828982 100644 --- a/config/sync/field.field.node.actualite.field_images.yml +++ b/config/sync/field.field.node.actualite.field_images.yml @@ -6,7 +6,14 @@ dependencies: - field.storage.node.field_images - node.type.actualite module: + - content_translation - image +third_party_settings: + content_translation: + translation_sync: + alt: alt + title: title + file: '0' id: node.actualite.field_images field_name: field_images entity_type: node @@ -14,7 +21,7 @@ bundle: actualite label: Images description: '' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: diff --git a/config/sync/field.field.node.actualite.field_liens.yml b/config/sync/field.field.node.actualite.field_liens.yml index c8806e2..76a2c46 100644 --- a/config/sync/field.field.node.actualite.field_liens.yml +++ b/config/sync/field.field.node.actualite.field_liens.yml @@ -14,7 +14,7 @@ bundle: actualite label: Liens description: '' required: false -translatable: false +translatable: true default_value: { } default_value_callback: '' settings: diff --git a/config/sync/language.content_settings.node.actualite.yml b/config/sync/language.content_settings.node.actualite.yml index 624e42f..d669dc0 100644 --- a/config/sync/language.content_settings.node.actualite.yml +++ b/config/sync/language.content_settings.node.actualite.yml @@ -8,7 +8,7 @@ dependencies: - content_translation third_party_settings: content_translation: - enabled: false + enabled: true bundle_settings: untranslatable_fields_hide: '0' id: node.actualite