'@exactmatchcount exact result(s) out of @count relevant result(s) for “@keys”', 'fr' => '@exactmatchcount résultat(s) exact(s) sur @count résultat(s) pertinent(s) pour « @keys »', ]; } /** * Adds the French translation of the new search message (H6). */ function materio_sapi_update_11001(): string { if (!\Drupal::moduleHandler()->moduleExists('locale')) { return 'locale is off: nothing to translate.'; } $strings = materio_sapi_search_infos_strings(); $storage = \Drupal::service('locale.storage'); $source = $storage->findString(['source' => $strings['source'], 'context' => '']); if (!$source) { $source = $storage->createString(['source' => $strings['source'], 'context' => ''])->save(); } $storage->createTranslation([ 'lid' => $source->lid, 'language' => 'fr', 'translation' => $strings['fr'], 'customized' => LOCALE_CUSTOMIZED, ])->save(); _locale_refresh_translations(['fr'], [$source->lid]); return 'French translation of the search message added.'; } /** * Sources of the search messages of F4 and their French translation. * * A plural is stored as singular and plural joined by PoItem::DELIMITER, for * the source and for the translation. */ function materio_sapi_search_messages_strings(): array { $plural = fn (string $one, string $many): string => $one . PoItem::DELIMITER . $many; return [ 'No results for “@keys”. Try other words or a broader description.' => 'Aucun résultat pour « @keys ». Essayez d’autres mots ou une description plus générale.', $plural('No exact result, @n close result for “@keys”', 'No exact result, @n close results for “@keys”') => $plural('Aucun résultat exact, @n résultat proche pour « @keys »', 'Aucun résultat exact, @n résultats proches pour « @keys »'), '1 exact result for “@keys”' => '1 résultat exact pour « @keys »', $plural('@n exact result out of @total relevant results for “@keys”', '@n exact results out of @total relevant results for “@keys”') => $plural('@n résultat exact sur @total résultats pertinents pour « @keys »', '@n résultats exacts sur @total résultats pertinents pour « @keys »'), // Former text, French corrected ("le champs"). 'Please use the search form to search from our @count materials.' => 'Utilisez le champ de recherche pour naviguer dans nos @count matériaux référencés.', ]; } /** * Adds the French translation of the search messages (F4). */ function materio_sapi_update_11002(): string { if (!\Drupal::moduleHandler()->moduleExists('locale')) { return 'locale is off: nothing to translate.'; } $storage = \Drupal::service('locale.storage'); $lids = []; foreach (materio_sapi_search_messages_strings() as $source_text => $fr) { $source = $storage->findString(['source' => $source_text, 'context' => '']); if (!$source) { $source = $storage->createString(['source' => $source_text, 'context' => ''])->save(); } $storage->createTranslation([ 'lid' => $source->lid, 'language' => 'fr', 'translation' => $fr, 'customized' => LOCALE_CUSTOMIZED, ])->save(); $lids[] = $source->lid; } _locale_refresh_translations(['fr'], $lids); return 'French translation of the search messages added.'; }