Closed (fixed)
Project:
Localization server
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2010 at 19:00 UTC
Updated:
31 Oct 2026 at 07:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gábor hojtsySo that would be a submission function to replace Windows line ending with Unix line endings? How can we do an update function for this in a sensible way?
Comment #2
droplet commentedhere is my patch. does it safe ?
and then require apply it into _l10n_community_import_one_string as well
Comment #3
gábor hojtsyIs this the reason for #999092: Import duplicate check broken in fact?
Comment #4
droplet commentedgreat, we can adding to l10n_community_trim().
Comment #5
good_man commentedExtra tab, you should run your patch on your patch :)
Powered by Dreditor.
Comment #6
droplet commented:)
Comment #7
good_man commentedOkay nice simple patch let's wait Gabor.
Comment #8
gábor hojtsyLooks good. What is going to happen to existing translations which might be wrong?
Comment #9
good_man commentedWe better need to trim them once and for all, just once. Then will leave it to this patch to filter the new ones.
Comment #10
droplet commentedmaybe hook_update, replace all of them once.
Comment #11
droplet commentedComment #12
good_man commentedAwesome! just a minor issue:
TABS :) replace with spaces.
Powered by Dreditor.
Comment #13
droplet commented#11 removed the TABS
Comment #14
good_man commentedI think it's ready.
Comment #15
sebcorbin commentedPatch #11 applied, everything is ok for me.
Comment #16
sebcorbin commentedI was wondering though, what about the possible duplicates generated by the update?
Comment #17
droplet commentedumm. it results two identical strings. but would not broken l10n_server functional or bring conflict error.
from LDO DB(snapshot-125, 04-10-2011), it has 3804 rows contains '\r\n' line breaks and 101 rows duplicated strings (around 10 strings have 3~7 duplicates result.)
**
Manually way to kill these 101 rows string better than write a update function to solve it I though..
Seems like FR is the most active group to use UI submitting strings
Comment #18
sebcorbin commentedWe need to add the duplicate removal to the update function, as this module is used on other sites.
l10n_community.install from #11 is also missing a new line at end of file
Comment #19
gábor hojtsyComment #20
gábor hojtsyThis is still a problem, also in 3.0.x. Browsers send the line breaks of a text area as
\r\n, so currently every translation of more than one line that is saved on the web gets\r\n, on Windows and elsewhere. In the database copy of localize.drupal.org of August 2026, 9,207 active translations in 91 languages had a carriage return that their source string did not have. 6,173 of them were approved, and 411 of them were added in 2026. They make the exported .po files fail the gettext checks (#2842984: Add the Language and X-Generator headers to the exported .po files).Proposed resolution addresses #8, #16 and #18 in two commits:
L10nPo::trim()changes\r\nand\rto\nin a new translation when its source string has no carriage return. The web form and the import both save through it, before the duplicate check. A translation of a source string with a carriage return keeps it.l10n_server:normalize-line-breaks(with--dry-run), changes the existing translations the same way. It keeps their changed time, so the packager does not package the releases of these strings again for this.l10n_server:merge-duplicate-translations(#3628846: Duplicate translations: merge them after the migration with their history, then keep translations unique) merges the copies that differed only in their line breaks, so the site should run it after this command in the migration. A count on the August 2026 copy found 13,948 translations to change, declined ones included, and 116 strings with copies of a text in a language after the change.A new unit test (
L10nPoTrimTest) checks the line breaks of new translations, and fail without the fix. A new kernel test (MergeDuplicateTranslationsTest::testNormalizeLineBreaks) checks the command, and that the merge merges the copies afterwards. The pre-existing suggestion, import, moderation history and merge tests still pass.Not covered: the remote API of
l10n_remotesaves translations withoutL10nPo::addSuggestion(), so without this trim, and also without the duplicate check, the lock and the history. That should be fixed with the remote API.Moving to 3.0.x.
LLM disclosure
LLM was used to find, diagnose, explain and fix this issue. With human review.
Comment #22
gábor hojtsyComment #24
gábor hojtsy