You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by duesenklipper <gi...@git.apache.org> on 2016/11/07 14:08:20 UTC
[GitHub] wicket pull request #188: Feature/locale format fix
GitHub user duesenklipper opened a pull request:
https://github.com/apache/wicket/pull/188
Feature/locale format fix
On some systems (like my desktop ;-) ) there is not one single `Locale`, but rather different ones for text and formats. For example, I use `en_US` for nearly everything, but `de_DE` for formatting. In this situation, `DurationTest` fails, because `DurationTest` correctly uses `NumberFormat.getNumberInstance`, which uses `Locale.getDefault(Locale.Category.FORMAT)`. `Duration` itself, however, just calls `Locale.getDefault()` and thus misses the difference. This patch simply fixes `Duration` to use the formatting locale.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/duesenklipper/wicket feature/locale-format-fix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/wicket/pull/188.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #188
----
commit efff42eb7a1fa5ee85344dc1fef831c85c17a3c9
Author: Carl-Eric Menzel <cm...@apache.org>
Date: 2016-08-09T14:45:46Z
make Duration use the FORMAT category of a locale
commit 50744f28cdb8d77390e41234ccd5821c43e69464
Author: Carl-Eric Menzel <cm...@apache.org>
Date: 2016-11-07T14:06:06Z
add test for Duration when default locale and formatting locale differ
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket pull request #188: Feature/locale format fix
Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on a diff in the pull request:
https://github.com/apache/wicket/pull/188#discussion_r89272848
--- Diff: wicket-util/src/test/java/org/apache/wicket/util/lang/BytesTest.java ---
@@ -40,10 +40,10 @@
@Before
public void before()
{
- defaultLocale = Locale.getDefault();
+ defaultLocale = Locale.getDefault(Locale.Category.FORMAT);
// these tests run in US locale.
- Locale.setDefault(Locale.US);
+ Locale.setDefault(Locale.Category.FORMAT, Locale.US);
--- End diff --
Would the test still pass without this change ?
I.e. if Category.FORMAT is not specified then does it fallback to the `generic` locale ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on the issue:
https://github.com/apache/wicket/pull/188
+1 to merge
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by klopfdreh <gi...@git.apache.org>.
Github user klopfdreh commented on the issue:
https://github.com/apache/wicket/pull/188
+1 to merge. @martin-g WDYT?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by duesenklipper <gi...@git.apache.org>.
Github user duesenklipper commented on the issue:
https://github.com/apache/wicket/pull/188
Ticket is at https://issues.apache.org/jira/browse/WICKET-6273, and I went through the various calls to Locale.getDefault. What do you think?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by duesenklipper <gi...@git.apache.org>.
Github user duesenklipper commented on the issue:
https://github.com/apache/wicket/pull/188
Yes, it would have still worked - I changed it so it explicitly tests for a split Locale now. If no formatting locale is set, `Locale.getDefault(FORMAT)` falls back to the "normal" default locale.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket pull request #188: Feature/locale format fix
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/wicket/pull/188
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by duesenklipper <gi...@git.apache.org>.
Github user duesenklipper commented on the issue:
https://github.com/apache/wicket/pull/188
I'd merge it myself, but I can so rarely work on wicket itself these days that I prefer having someone look at it first.
If this one is accepted, I'll add the same thing to 8.x myself.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] wicket issue #188: Feature/locale format fix
Posted by martin-g <gi...@git.apache.org>.
Github user martin-g commented on the issue:
https://github.com/apache/wicket/pull/188
1. A ticket in JIRA should be created for any PR, so that it appears in the CHANGELOG and users can see it.
2. Quick search for calls to `Locale.getDefault()` shows 40 occurrences in Wicket. IMO we should go over all of them and see whether they need such improvements as well.
My 2c.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---