Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi guys,
i´ll explain my problem with a scenario. I hope it gets clear for you:
- Multilingual D7-Setup (EN + DE as default-language)
When i install the countries module with the previous settings i only get the field (and all the countries) in german, not in english.
But when i install the countries module with english as default-language i only get the field (with countries) in english, not in german.
Any ideas?
Comment | File | Size | Author |
---|---|---|---|
#16 | countries-t-function-for-imports-1490864-15.patch | 2.08 KB | Alan D. |
#14 | countries-t-function-for-imports-1490864-14.patch | 2.3 KB | firfin |
#4 | countries-t-function-for-imports-1490864-4.patch | 2.29 KB | firfin |
#1 | countries-t-function-for-imports.patch | 2.17 KB | Alan D. |
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedThis is by design as the strings are imported and treated as user data that should not override the default strings supplied by drupal. So set the default language to German and you will get country names returned in German due to the use of t() when defining this list in core. All other values will be imported in English (official names column)
Since the countries data file is (almost) static, we could run these values through t() during the import / update so that if there are available translations, the database would be populated with the correct (i.e. current) language.
I'll let webflo respond too, but this solution would be something like:
Completely untested patch attached
Comment #3
Alan D. CreditAttribution: Alan D. commented[edit] Wrong thread.
Comment #4
firfin CreditAttribution: firfin commentedRe-rolled to make it patch successfully.
Also made some small changes:
- As we already do
$key = $headers[$index];
above changed the elseif statement to use $key (instead of $headers[$index] )for readability.- removed a typo
Comment #5
firfin CreditAttribution: firfin commentedforgot to set status :-(
Comment #7
firfin CreditAttribution: firfin commented#4: countries-t-function-for-imports-1490864-4.patch queued for re-testing.
Comment #9
firfin CreditAttribution: firfin commentedPatched against dev of course, oops.
Comment #10
firfin CreditAttribution: firfin commented#4: countries-t-function-for-imports-1490864-4.patch queued for re-testing.
Comment #12
Alan D. CreditAttribution: Alan D. commented+ // Enable translation of country names during importation.
+ $value = t($value);
This doesn't assign the value and thus appears to completely break the import. Move to the last else in the statement where the value is assigned
Comment #13
Alan D. CreditAttribution: Alan D. commentedie:
Comment #14
firfin CreditAttribution: firfin commentedAlan D.++
You are absolutely correct.
I corrected my mistake and tested locally.
No more errors, seems to be okay now.
Any other improvements needed?
Comment #15
Alan D. CreditAttribution: Alan D. commentedMinor mods, will push if I get the green light (too lazy to manually test and there are very detailed tests for this)
Comment #16
Alan D. CreditAttribution: Alan D. commentedComment #17
Alan D. CreditAttribution: Alan D. commentedThanks Marck - committed