Bug 275039 - [PATCH] switch to semantic internationalisation
Summary: [PATCH] switch to semantic internationalisation
Status: CLOSED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-RAW (show other bugs)
Version: 2.0.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 12:24 UTC by Torbjörn K.
Modified: 2012-06-27 10:27 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.0.0
Sentry Crash Report:


Attachments
changing from i18n to i18nc (69.17 KB, patch)
2011-06-06 12:24 UTC, Torbjörn K.
Details
updated patch (69.17 KB, patch)
2011-06-07 09:33 UTC, Torbjörn K.
Details
everything is a learning process... (57.12 KB, patch)
2011-06-07 13:50 UTC, Torbjörn K.
Details
...still learning... (56.15 KB, patch)
2011-06-07 14:29 UTC, Torbjörn K.
Details
review-me.patch (67.84 KB, patch)
2011-06-07 14:54 UTC, Francesco Riosa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjörn K. 2011-06-06 12:24:03 UTC
Created attachment 60686 [details]
changing from i18n to i18nc

Version:           unspecified (using Devel) 
OS:                Linux

This patch alters all i18n calls to its semantic counterpart i18nc and adds semantic labels and markup to the strings. I did not alter the context of the strings, just the markup. Thus, it should be easy to update for translators.

Changes were made in libkdcraw/dcrawsettingswidget.cpp, libkdcraw/rnuminput.cpp and libkdcraw/rcombobox.cpp.

However, I do not understand the following (and only) Krazy warnings in dcrawsettingswidget.cpp, as I cannot find anything odd in the corresponding lines:

13. Check validity of i18n calls [i18ncheckarg]... 7 issues found
	dcrawsettingswidget.cpp: missing KUIT context marker line#593,627
	dcrawsettingswidget.cpp: single adjective as message, probably ambiguous; explain what it refers to following the KUIT context marker line#316,343,365,420,432

Reproducible: Always




Patch against master. Compiled with latest KDE trunk available through openSUSE repositories. Tested in self-compiled digikam from master.
Comment 1 caulier.gilles 2011-06-07 09:25:02 UTC
I cannot apply your patch against current git master:

[gilles@localhost libkdcraw]$ git reset --hard HEAD
HEAD is now at 780bfb0 apply patch #60673

[gilles@localhost libkdcraw]$ patch -p0 < libkdcraw_i18nc_r1.patch 
patching file libkdcraw/dcrawsettingswidget.cpp
Reversed (or previously applied) patch detected!  Assume -R? [n] R
Apply anyway? [n] y
Hunk #1 FAILED at 183.
Hunk #2 FAILED at 200.
Hunk #3 FAILED at 220.
Hunk #4 FAILED at 326.
Hunk #5 FAILED at 354.
Hunk #6 FAILED at 455.
Hunk #8 FAILED at 521.
Hunk #9 FAILED at 550.
Hunk #10 succeeded at 594 (offset 2 lines).
Hunk #11 FAILED at 600.
Hunk #12 succeeded at 658 (offset 2 lines).
Hunk #13 FAILED at 867.
Hunk #14 succeeded at 952 (offset 2 lines).
Hunk #15 succeeded at 1020 (offset 2 lines).
Hunk #16 succeeded at 1043 (offset 2 lines).
Hunk #17 succeeded at 1071 (offset 2 lines).
Hunk #18 succeeded at 1118 (offset 2 lines).
Hunk #19 succeeded at 1140 (offset 2 lines).
Hunk #20 succeeded at 1164 (offset 2 lines).
10 out of 20 hunks FAILED -- saving rejects to file libkdcraw/dcrawsettingswidget.cpp.rej
patching file libkdcraw/rcombobox.cpp
patching file libkdcraw/rnuminput.cpp

Gilles Caulier
Comment 2 Torbjörn K. 2011-06-07 09:33:15 UTC
Created attachment 60726 [details]
updated patch

the first did not work, thus a new try
Comment 3 Torbjörn K. 2011-06-07 09:34:34 UTC
I'm sorry for causing problems. I created the patch through Kdevelop via right clicking on the project root (libkdcraw) and using Git -> compare against HEAD. If this update does not work, I can email you these three files.
Comment 4 caulier.gilles 2011-06-07 10:51:19 UTC
It's always the same :

[gilles@localhost libkdcraw]$ patch -p0 < libkdcraw_i18nc_r1.patch 
patching file libkdcraw/dcrawsettingswidget.cpp
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
20 out of 20 hunks ignored -- saving rejects to file libkdcraw/dcrawsettingswidget.cpp.rej
patching file libkdcraw/rcombobox.cpp
patching file libkdcraw/rnuminput.cpp
[gilles@localhost libkdcraw]$ 

The problem is with dcrawsettingswidget.cpp. I suspect that your local git repository is not up to date. performing "git pull" before to make patch will solve the problem. Also use "git diff > foo.patch" to make patch.

Gilles Caulier
Comment 5 Torbjörn K. 2011-06-07 13:50:41 UTC
Created attachment 60741 [details]
everything is a learning process...

Thank you for your help and I hope this one works. I'm sorry for causing these troubles. It's my first time working on source code in a collaborative environment.

I did the following:

myself@suseTower:/kde/kdesrc/git/kde/kdegraphics/libs/libkdcraw> git pull
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (8/8), done.
From git://anongit.kde.org/libkdcraw
   328344c..a9da867  master     -> origin/master
Updating 328344c..a9da867
error: Your local changes to the following files would be overwritten by merge:
        libkdcraw/dcrawsettingswidget.cpp
Please, commit your changes or stash them before you can merge.
Aborting
myself@suseTower:/kde/kdesrc/git/kde/kdegraphics/libs/libkdcraw> git diff > /kde/diffs/libkdcraw_i18nc_r1.patch
myself@suseTower:/kde/kdesrc/git/kde/kdegraphics/libs/libkdcraw> path -p0 < /kde/diffs/libkdcraw_i18nc_r1.patch
myself@suseTower:/kde/kdesrc/git/kde/kdegraphics/libs/libkdcraw>
Comment 6 caulier.gilles 2011-06-07 14:16:05 UTC
Its' always the same :

[gilles@localhost libkdcraw]$ patch -p1 < libkdcraw_i18nc_r1.patch 
patching file libkdcraw/dcrawsettingswidget.cpp
Hunk #1 FAILED at 200.
Hunk #2 FAILED at 220.
Hunk #3 FAILED at 326.
Hunk #4 FAILED at 354.
Hunk #5 FAILED at 455.
Hunk #7 FAILED at 521.
Hunk #8 FAILED at 550.
Hunk #9 succeeded at 594 (offset 2 lines).
Hunk #10 FAILED at 600.
Hunk #11 succeeded at 658 (offset 2 lines).
Hunk #12 FAILED at 867.
9 out of 12 hunks FAILED -- saving rejects to file libkdcraw/dcrawsettingswidget.cpp.rej                                      
patching file libkdcraw/rcombobox.cpp                                                                                         
patching file libkdcraw/rnuminput.cpp            

Do you have merged your changes from your local repository with my last changes from git masrter, before to make patch?

Gilles Caulier
Comment 7 Torbjörn K. 2011-06-07 14:29:41 UTC
Created attachment 60743 [details]
...still learning...

Ok. Now I first copied my locally changed file to another directory, deleted the file in my local clone of the repository and pulled the latest version from git. Then I used KDiff3 to compare and merge those two files. Finally I used git diff to produce this patch file.
Comment 8 caulier.gilles 2011-06-07 14:41:15 UTC
Git commit ceb4cd533344c92977485625c1740c71bc69e56a by Gilles Caulier.
Committed on 07/06/2011 at 14:40.
Pushed by cgilles into branch 'master'.

apply patch #60743
BUGS: 275039

M  +272  -237  libkdcraw/dcrawsettingswidget.cpp     
M  +1    -1    libkdcraw/rcombobox.cpp     
M  +2    -2    libkdcraw/rnuminput.cpp     

http://commits.kde.org/libkdcraw/ceb4cd533344c92977485625c1740c71bc69e56a
Comment 9 caulier.gilles 2011-06-07 14:42:14 UTC
Patch applied (:=)))...

for these warnings :

13. Check validity of i18n calls [i18ncheckarg]... 7 issues found
    dcrawsettingswidget.cpp: missing KUIT context marker line#593,627
    dcrawsettingswidget.cpp: single adjective as message, probably ambiguous;
explain what it refers to following the KUIT context marker
line#316,343,365,420,432

I have no idea. Ask to i18n team coordinator.

Gilles Caulier
Comment 10 Francesco Riosa 2011-06-07 14:54:23 UTC
Created attachment 60748 [details]
review-me.patch

(In reply to comment #5)
[snip]
> error: Your local changes to the following files would be overwritten by merge:
>         libkdcraw/dcrawsettingswidget.cpp
> Please, commit your changes or stash them before you can merge.
> Aborting
[snip]
This error mean that git is unable to automatically merge the two repositories and manual merge is needed.

http://book.git-scm.com/5_advanced_branching_and_merging.html

explain something about conflict-resolution, would like to help more but I'm myself unfamiliar with the matter. In fact usually when conflict happen I do start from a fresh copy and re-apply all the patches when possible and do manually the rest.

I've done this for you and you can see attached the patch against HEAD of libkdcraw, it has been done in a hurry please check it double

Also a suggestion for the next time. try to limit the number of changes per commit, for example this patch caould have been divided into:
1) add @item and change to i18nc
2) re-format lines lenght
Comment 11 Francesco Riosa 2011-06-07 14:57:31 UTC
oh oh, seem I'm arrived late
Comment 12 caulier.gilles 2011-06-07 15:00:01 UTC
Thanks Francesco,

But, i suppose that torbjoern do not have used or merged current change from git master and local repository. As i use a git master up to date, applying patch failed.

Gilles Caulier
Comment 13 Torbjörn K. 2011-06-07 15:07:33 UTC
Thank you, Francesco, for the link and suggestions. I'll read it for future use.
Comment 14 Francesco Riosa 2011-06-07 15:45:04 UTC
(In reply to comment #12)
> Thanks Francesco,
> 
> But, i suppose that torbjoern do not have used or merged current change from
> git master and local repository. As i use a git master up to date, applying
> patch failed.
> 
> Gilles Caulier

hum, that's me not explaining well as usual, I've used the first patch attached to this bug, applied it to current git master and then re-made the diff (attach id=60748) because for me previous one (attach id=60743) was still not applying cleanly.
In the meantime you were already working on it and solved differently ;) right?
Comment 15 caulier.gilles 2011-06-07 19:25:39 UTC
well, the last one provided have been applied successfully to git master as well...

Gilles