1446 |
return this.option_locale; |
return this.option_locale; |
1447 |
} |
} |
1448 |
|
|
1449 |
|
/** |
1450 |
|
* Return the collator to use based on the specified -locale |
1451 |
|
* option. If no collator can be found for the given locale, a |
1452 |
|
* warning is emitted and the default collator is used instead. |
1453 |
|
*/ |
1454 |
public Collator getCollator() |
public Collator getCollator() |
1455 |
{ |
{ |
1456 |
if (null == this.collator) { |
if (null == this.collator) { |
1457 |
this.collator = Collator.getInstance(getLocale()); |
Locale locale = getLocale(); |
1458 |
this.collator.setStrength(Collator.SECONDARY); |
this.collator = Collator.getInstance(locale); |
1459 |
|
Locale defaultLocale = Locale.getDefault(); |
1460 |
|
if (null == this.collator |
1461 |
|
&& !defaultLocale.equals(locale)) { |
1462 |
|
this.collator = Collator.getInstance(defaultLocale); |
1463 |
|
if (null != this.collator) { |
1464 |
|
reporter.printWarning("No collator found for locale " |
1465 |
|
+ locale.getDisplayName() |
1466 |
|
+ "; using collator for default locale " |
1467 |
|
+ defaultLocale.getDisplayName() |
1468 |
|
+ "."); |
1469 |
|
} |
1470 |
|
else { |
1471 |
|
this.collator = Collator.getInstance(); |
1472 |
|
reporter.printWarning("No collator found for specified locale " |
1473 |
|
+ locale.getDisplayName() |
1474 |
|
+ " or default locale " |
1475 |
|
+ defaultLocale.getDisplayName() |
1476 |
|
+ ": using default collator."); |
1477 |
|
} |
1478 |
|
} |
1479 |
|
if (null == this.collator) { |
1480 |
|
this.collator = Collator.getInstance(); |
1481 |
|
reporter.printWarning("No collator found for locale " |
1482 |
|
+ locale.getDisplayName() |
1483 |
|
+ ": using default collator."); |
1484 |
|
} |
1485 |
} |
} |
1486 |
return this.collator; |
return this.collator; |
1487 |
} |
} |