-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Externalize the 'difference/s' text #1236 #1248
Externalize the 'difference/s' text #1236 #1248
Conversation
String label = differenceCount > 1 ? differenceCount + " Differences" //$NON-NLS-1$ | ||
: differenceCount == 1 ? differenceCount + " Difference" : "No Difference"; //$NON-NLS-1$ //$NON-NLS-2$ | ||
String label = differenceCount > 1 ? differenceCount + CompareMessages.TextMergeViewer_differences | ||
: differenceCount == 1 ? differenceCount + CompareMessages.TextMergeViewer_difference : CompareMessages.TextMergeViewer_no_difference; //$NON-NLS-1$ //$NON-NLS-2$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still not good for localization. There are languages in which the plural for two items is different from the plural of > 2 items. Just take a look at https://lingohub.com/blog/pluralization#cldr-overview . Pluralization is hard.
A better way to do this is to leave the choice to the translator. Using MessageFormat.format
you could define a single message
TextMergeViewer_differences={0,choice,0#No differences|1#1 difference|1<{0} differences}
and then
String label = MessageFormat.format(CompareMessages.TextMergeViewer_differences, differenceCount);
This gives translators much more leeway in producing correct translations. It'll also format the number according to localized rules, for instance with thousands separators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know either that this was possible. Nice
@lathapatil: Can you adapt your PR accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will check on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible, though standard Java MessageFormat still is not powerful enough to handle all cases. A translator would still struggle to get the right plurals for most slavic languages. ICU has full support for doing this right, but unfortunately Eclipse ditched ICU a while ago "because it was too big".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason why we ditched ICU was that maintenance of this library was not actively done. IIRC there was one part time person working on it in IBM with his focus on other things.
c87e639
to
66c2f4d
Compare
"Expected to have bigger x.y.z than what is available in baseline (3.10.0.v20240208-0728)" You need to increase the version number of org.eclipse.compare to 3.10.100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
increase version number
ok. I have one basic question regarding version bump . When and why we have to increase the version now for this fix ? |
The version number has to be increase once each release cycle if changes are made to the code in the bundle. |
9c89b82
to
b726c79
Compare
AllCompareTests org.eclipse.compare.tests.TextMergeViewerTest is failing. Might this be caused by your change? |
Yes. Previously it was Uppercase 'D' in the text "Differences" and now It is lowercase 'd' Either I have to change in testcase or the properties file .. which one is preferred ? |
.../bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties
Outdated
Show resolved
Hide resolved
A it's a "title" / "caption" this should be title-case style. |
Externalization of text used in "Textmergeviewer.java" related to number of differences shown in toolbar of compare editor using MessageFormat.format Version bump to 3.10.100 Update team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties Co-authored-by: Matthias Becker <[email protected]>
304b833
to
b69f054
Compare
Externalization of text used in "Textmergeviewer.java" related to number of differences shown in toolbar of compare editor.
Fixes #1236