Posted by derhasi on September 15, 2011 at 4:33am
12 followers
| Project: | Features |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | sprint candidate |
Issue Summary
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.
Comments
#1
And there is the patch.
#2
Your patch is empty :)
#3
Ok :D Finally it's here again ...
#4
#5
Tagging
#6
I 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
#7
+++ b/includes/features.locale.inc@@ -0,0 +1,160 @@
+ 'plurals' => empty($language->plurals) ? '' : $language->plurals,
The 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.
#8
@helmo, I assume we even have to use
0instead of'0'.@apaatsio , could you review/test the patch again please? ;)
#9
@derhasi: Yes, the 0 is better.
I think that this is ready...
#10
Minor coding standards issue; have you run the file through coder?
+++ b/includes/features.locale.inc@@ -0,0 +1,160 @@
+ // Add language to exports
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();
+++ b/includes/features.locale.inc@@ -0,0 +1,160 @@
+ if (array_key_exists($name, $language_list)) {
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 ''.
+++ b/includes/features.locale.inc@@ -0,0 +1,160 @@
+ // Rebuild locale javascript hashs.
+ //_locale_rebuild_js($language->language);
Commented out code? :(
+++ b/includes/features.locale.inc@@ -0,0 +1,160 @@
\ No newline at end of file
New line!
#11
Oh, sure coder ... and your are right with your other comments too ;)
I attached a cleaned up patch.
#12
Great, still works as expected :)
#13
#8 works for me
#14
The patch in #11 applies cleanly and works as expected. Great work Johannes!
#15
+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
<?php/**
* Implements hook_enable().
*/
function my_feature_enable() {
l10n_update_modules_enabled(module_list());
}
?>
but it does not work :/
#16
Committed 1027e94
#17
mpotter, it seems you forgot the include file :)
#18
New patch with the remaining includes/features.locale.inc file.
#19
Ack. Just forgot to add the include file to git. Committed with include file f6ff815.
#20
Automatically closed -- issue fixed for 2 weeks with no activity.