Perhaps it's just me but I'm having difficulties in getting plurals working in D7 using the 7.x-2.0 version of the module.
To be more specific I see that plurals are no longer stored as separate entries within the database and instead are concatenated using the L10N_UPDATE_PLURAL_DELIMITER
('\03') character and stored within a single row. The result of which is not only missed translations for plural strings but also their respective singular counterparts.
In addition, manual editing of plural translations using the translation interface UI is problematic with respect to the aforementioned L10N_UPDATE_PLURAL_DELIMITER
character.
Any suggestions would be greatly appreciated.
Comment | File | Size | Author |
---|---|---|---|
#17 | interdiff-2501315-16-17.txt | 24.83 KB | Sutharsan |
#17 | l10n_update-plural-handling-fix-2501315-17.patch | 19.84 KB | Sutharsan |
#16 | l10n_update-plural-handling-fix-2501315-16.patch | 13.34 KB | Sutharsan |
#12 | interdiff-2501315-11-12.txt | 10.32 KB | Sutharsan |
#12 | l10n_update-plural-handling-fix-2501315-12.patch | 13.37 KB | Sutharsan |
Comments
Comment #1
Dan Kennard CreditAttribution: Dan Kennard commentedComment #2
Dan Kennard CreditAttribution: Dan Kennard commentedComment #3
Sutharsan CreditAttribution: Sutharsan commentedYou are the first reporting this, but you may be very right. I think this is an omission and due to the use of Drupal 8 code in this version. I need to look into this.
Comment #4
Jim Kirkpatrick CreditAttribution: Jim Kirkpatrick commentedThis affects us too...
Seems we have a choice:
@Sutharsan which way do you lean, any thoughts on the best approach? We can spend dev time on a patch for this, but would like a steer from you as to the best direction. Thanks.
Comment #5
Gábor Hojtsy@Jim: Drupal 7 is frozen in terms of its API so the module should be fixed to store plurals as core expects.
Comment #6
Dan Kennard CreditAttribution: Dan Kennard commentedEdit - Made some progress on this one. Patch forthcoming over the next day or so
Comment #7
Dan Kennard CreditAttribution: Dan Kennard commentedHopefully this will do the job in that plural strings are now stored separately. I've added a drush command which will attempt to fix previously imported D8 style plurals but perhaps it would be better to place the logic within an update hook?
Comment #8
Dan Kennard CreditAttribution: Dan Kennard commentedComment #9
Jim Kirkpatrick CreditAttribution: Jim Kirkpatrick commentedPatch at #7 works for us, thanks Dan!
Comment #10
FreekVR CreditAttribution: FreekVR commentedThanks, the patch in #7 is working for us as well :)
Comment #11
Sutharsan CreditAttribution: Sutharsan commentedThe update function should also be available for non-drush users, as it fixes plural strings for all.
I will fix code style and some minor stuff in a separate patch.
Comment #12
Sutharsan CreditAttribution: Sutharsan commentedFixed some code style, naming, interface strings, white space and other minor stuf.
Remaining todo's
Comment #13
Sutharsan CreditAttribution: Sutharsan commentedComment #14
idebr CreditAttribution: idebr at One Shoe commentedThe
if
is closed prematurely on line 542. This results in a parse error in the install file:Parse error: syntax error, unexpected 'else' (T_ELSE) in [...]/l10n_update.install on line 538
Comment #15
Sutharsan CreditAttribution: Sutharsan commentedI want to release a 7.x-2.1 shortly and like to include this fix. Is there anyone here who want to finish this patch?
Comment #16
Sutharsan CreditAttribution: Sutharsan commentedRerolled
Comment #17
Sutharsan CreditAttribution: Sutharsan commentedI discovered that the writer classes were not capable of handling D7 style plurals yet. The changes in the above patches only handled the the plural delimiter, but not the difference in database table fields and not the additional database records for plurals for languages with > 1 plural form.
Further I decided to drop the drush support of D8 to D7 string conversion in favor of hook_update_N. Once the update script is executed, I see no more need for running the conversion again via drush.
All togehter it turned out to be a total rewrite of the patch.
Comment #19
Sutharsan CreditAttribution: Sutharsan commentedI've tested the patch with two languages. One with multiple plurals (Arabic) and one with 2 plurals (Hungarian).
All cases resulted in the same records in the locales_source and locales_target tables.
Comment #20
Sutharsan CreditAttribution: Sutharsan commented