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.
as follow up of #1083394: Meta issue: Features support for core component types added in D7
For a custom project I wrote some language implementation. Patch will come in first comment.
Comment | File | Size | Author |
---|---|---|---|
#18 | features-locale-1279938-18.patch | 4.54 KB | helmo |
#11 | features-locale-1279938-11.patch | 5.38 KB | derhasi |
#8 | features-locale-1279938-8.patch | 5.41 KB | derhasi |
#7 | features-locale-1279938-7.patch | 5.41 KB | helmo |
#3 | features-locale-1279938-3.patch | 5.41 KB | derhasi |
Comments
Comment #1
derhasi CreditAttribution: derhasi commentedAnd there is the patch.
Comment #2
febbraro CreditAttribution: febbraro commentedYour patch is empty :)
Comment #3
derhasi CreditAttribution: derhasi commentedOk :D Finally it's here again ...
Comment #4
derhasi CreditAttribution: derhasi commentedComment #5
e2thex CreditAttribution: e2thex commentedTagging
Comment #6
apaatsio CreditAttribution: apaatsio commentedI got this error when enabling a feature:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'plurals' at row 1: UPDATE {languages} SET plurals=:db_update_placeholder_0, formula=:db_update_placeholder_1 WHERE (language = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => [:db_update_placeholder_1] => [:db_condition_placeholder_0] => fi ) in _features_language_save() (line 138 of /www/sites/all/modules/contrib/features/includes/features.locale.inc).
Using
Comment #7
helmo CreditAttribution: helmo commentedThe default value should probably be '0' instead of '', adding a new patch.
I didn't experience the error from #6 myself, but that's because I was testing a language which has plurals set to 2.
Comment #8
derhasi CreditAttribution: derhasi commented@helmo, I assume we even have to use
0
instead of'0'
.@apaatsio , could you review/test the patch again please? ;)
Comment #9
helmo CreditAttribution: helmo commented@derhasi: Yes, the 0 is better.
I think that this is ready...
Comment #10
hefox CreditAttribution: hefox commentedMinor coding standards issue; have you run the file through coder?
Missing .
+
+ // No pipe.
+ $pipe = array();
+ return $pipe;
This isn't against coding standards, but it just looks odd. I'd either put $pipe at the top, or return array();
Not against coding standards again, but tmk array_key_exists is slower and not as useful as !empty($language_list[$name]); for example, $language_list could be array('blah' => '') and array key exist would return true, despite blah being ''.
Commented out code? :(
New line!
Comment #11
derhasi CreditAttribution: derhasi commentedOh, sure coder ... and your are right with your other comments too ;)
I attached a cleaned up patch.
Comment #12
helmo CreditAttribution: helmo commentedGreat, still works as expected :)
Comment #13
apaatsio CreditAttribution: apaatsio commented#8 works for me
Comment #14
wmostrey CreditAttribution: wmostrey commentedThe patch in #11 applies cleanly and works as expected. Great work Johannes!
Comment #15
DuaelFr+1 RTBC
I would like to find a hook to add some code after reverting/rebuilding a feature.
For example, it would be nice to run l10n_update after importing new languages.
I tried
but it does not work :/
Comment #16
mpotter CreditAttribution: mpotter commentedCommitted 1027e94
Comment #17
DuaelFrmpotter, it seems you forgot the include file :)
Comment #18
helmo CreditAttribution: helmo commentedNew patch with the remaining includes/features.locale.inc file.
Comment #19
mpotter CreditAttribution: mpotter commentedAck. Just forgot to add the include file to git. Committed with include file f6ff815.