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.
I did a fresh minimal installation of drupal 7.14.
I only added
Countries 7.x-2.0+5-dev (2012-Jun-23)
Entity API 7.x-1.0-rc3
Entity Translation 7.x-1.0-alpha2
In 'admin/modules' I switched on 'Countries' and 'Entity Translation'.
When I check 'Country' under 'Translatable entity types' in 'admin/config/regional/entity_translation'
I get the Error:
'The entities of type Country do not define a valid base path: it will not be possible to translate them.'
Do I need some additional modules or configuration or is it a bug?
Comments
Comment #1
Alan D. CreditAttribution: Alan D. commentedI think that the countries_i18n sub-module would handle all of the main property translations, are you also trying to set translatable fields on the countries entity?
There is a bundle path defined on the entity bundle, but I'll download the translation module to see what it is complaining about.
i.e.
Comment #2
Alan D. CreditAttribution: Alan D. commentedOK, the module is not compatible. Firstly, I see that the following is required
Hopefully nothing else. So if you add this to countries.module and flush your cache, chances are you will get some integration happening. Let me know how it goes and I'll look at adding this to the main module if it works
Comment #3
haegar der schreckliche CreditAttribution: haegar der schreckliche commentedYes, this helps. The error is gone.
Thanks for the quick response!
Comment #4
Alan D. CreditAttribution: Alan D. commentedDoes it work correctly? I have no testing environment to try :)
Comment #5
haegar der schreckliche CreditAttribution: haegar der schreckliche commentedTo be honest, I still did not figure out how to use translation in views which is my use case.
I have a content type with a country field and I have a view which is supposed to display the content with the country field in a different language.
While trying I found this error message and thought it would be good to report.
Therefor I can't say if it works correctly, sorry!
Comment #6
Alan D. CreditAttribution: Alan D. commentedwebflo done the i18n component and created an translated widget for the module + i18n strings support.
I personally wonder if we should drop that and just run every country entity through country_t(). Currently, we can not as this would be constantly generated and performance could be an issue, but if we can get a language based cache of the country entity working then this is going to be the path forward.
The error [aka ET message] is related to the Entity Translation module warning that there is no integration, but leaving open as a feature request
Comment #7
webflo CreditAttribution: webflo commentedThe country name is a property. Properties are not translatable with Entity Translation. ET is for fields only. You should look into the title module too.
Comment #8
Alan D. CreditAttribution: Alan D. commentedThis appears to be the minimal patch to enable integration for the fields. Love some one to test as I do not have an i18n set up!
Comment #9
Alan D. CreditAttribution: Alan D. commentedAdded to #2032835: [META] Finialise i18n issues. Desperately needing reviews from i18n users ;)
Comment #10
SiliconMind CreditAttribution: SiliconMind commentedI'm sorry to reopen, but since i18n does not care about proper language fallback and Entity translation is heading into the core (#1836086: [meta] Entity Translation UI improvements), it would be nice to use it instead of i18n.
Unfortunately your small patch is not enough, because when I try to translate a country Entity translation complains that there are "No translatable fields". Does anyone have any ideas how to integrate Countries module with Entity translation properly?
Comment #11
bdziewierz CreditAttribution: bdziewierz commentedPlease refer to attached. It offers integration with Entity Translation for fields. The only issue I am getting is that properties replaced by Title module still don't work as expected. Any suggestions?
Comment #12
plachComment #18
czigor CreditAttribution: czigor at Liip commentedReroll.
Comment #20
czigor CreditAttribution: czigor at Liip commentedGet rid of ENTITY_TRANSLATION_LANGUAGE_CURRENT in favor of LANGUAGE_NONE since Entity Translation might not be enabled.
Comment #23
mhmd CreditAttribution: mhmd as a volunteer and commentedthe last patch countries-entity-translation-1660370-20.patch gives error
Fatal error: Class 'EntityTranslationCountryHandler' not found in /var/www/html/exbooth/sites/all/modules/entity_translation/includes/translation.handler_factory.inc on line 93
drupal version = "7.x-3.9"
countries version = "7.x-2.3"
entity translation version = "7.x-1.0-beta4"
Comment #24
joelpittet@mhmd did you try rebuilding the registry? It looks correct here in files[]
Comment #25
Alan D. CreditAttribution: Alan D. commentedOr simply running update.php :)
Comment #26
mhmd CreditAttribution: mhmd as a volunteer and commentedI did drush updb also drush up Even I tried in a clean installation the same error appeared again
Still not working
Comment #27
Andrew Edwards CreditAttribution: Andrew Edwards commentedThe patch at #20 works nicely, so thanks!
One bug I've found is using name_field as a token (I'm using it to give a page title using page manager).
The offending token: %country:name_field
the error:
Notice: Array to string conversion in ctools_context_keyword_substitute() (line 694 of /Websites/ida2/profiles/openethical/modules/contrib/ctools/includes/context.inc).
I spent some time tracking down the cause of the error and it seems that this code (from countries.module line 885 function country_property) is causing the problem:
Basically, $output should be a string. But, because there are multiple languages $country->property for the field name_field is actually an array.
Comment #28
Andrew Edwards CreditAttribution: Andrew Edwards commentedHmn, actually. I don't think the code I mentioned in #27 is the problem.
I think the problem is that the function countries_tokens (line 70 countries.tokens.inc) is fiddling around with the content of the tokens name_field and official_name_field.
Here's the offending code:
$replacements[$original] = country_property($country, str_replace('-', '_', $name), '', $sanitize);
Comment #29
Andrew Edwards CreditAttribution: Andrew Edwards commentedPatch attached including the bug mentioned in #27 and #28