Needs review
Project:
Countries
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Jun 2012 at 08:42 UTC
Updated:
14 Jan 2016 at 19:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
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. 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 commentedYes, this helps. The error is gone.
Thanks for the quick response!
Comment #4
alan d. commentedDoes it work correctly? I have no testing environment to try :)
Comment #5
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. 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 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. 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. commentedAdded to #2032835: [META] Finialise i18n issues. Desperately needing reviews from i18n users ;)
Comment #10
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 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 commentedReroll.
Comment #20
czigor commentedGet rid of ENTITY_TRANSLATION_LANGUAGE_CURRENT in favor of LANGUAGE_NONE since Entity Translation might not be enabled.
Comment #23
mhmd 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. commentedOr simply running update.php :)
Comment #26
mhmd 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 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 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 commentedPatch attached including the bug mentioned in #27 and #28