Skip to content

Commit

Permalink
Upgrade ICU4X to different branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Jul 24, 2024
1 parent 809a26b commit ca3f1ca
Show file tree
Hide file tree
Showing 18 changed files with 14 additions and 25 deletions.
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/Bcp47ToIanaMapper.g.dart
1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/CalendarError.g.dart

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/DataError.g.dart

This file was deleted.

1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/FixedDecimalLimitError.g.dart

This file was deleted.

1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/FixedDecimalParseError.g.dart

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/IanaToBcp47Mapper.g.dart
1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/LocaleParseError.g.dart

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/RoundingIncrement.g.dart
1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/TimeZoneInvalidIdError.g.dart

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class DateTimeFormat4X extends DateTimeFormatImpl {
icu.Calendar.forKind(_data, calendarKind),
);
if (_zonedDateTimeFormatter != null) {
final ianaToBcp47Mapper = icu.TimeZoneIdMapper(_data);
final ianaToBcp47Mapper = icu.IanaToBcp47Mapper(_data);
final timeZone = icu.CustomTimeZone.empty()
..trySetIanaTimeZoneId(ianaToBcp47Mapper, options.timeZone!);
return _zonedDateTimeFormatter.formatDatetimeWithCustomTimeZone(
Expand Down
4 changes: 2 additions & 2 deletions pkgs/intl4x/lib/src/locale/locale_4x.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'locale.dart';
extension Locale4X on Locale {
icu.Locale to4X() {
final icu4xLocale = icu.Locale.und()..language = language;
if (region != null) icu4xLocale.setRegion(region!);
if (script != null) icu4xLocale.setScript(script!);
if (region != null) icu4xLocale.region = region!;
if (script != null) icu4xLocale.script = script!;
return icu4xLocale;
}
}
17 changes: 6 additions & 11 deletions pkgs/intl4x/lib/src/number_format/number_format_4x.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class NumberFormat4X extends NumberFormatImpl {
final icu.FixedDecimal fixedDecimal;
fixedDecimal = switch (number) {
final int i => icu.FixedDecimal.fromInt(i),
final double d => icu.FixedDecimal.fromDoubleWithFloatingPrecision(d),
final double d => icu.FixedDecimal.fromDoubleWithDoublePrecision(d),
final String s => icu.FixedDecimal.fromString(s),
Object() => icu.FixedDecimal.fromString(number.toString()),
};
Expand Down Expand Up @@ -103,16 +103,11 @@ class NumberFormat4X extends NumberFormatImpl {
RoundingMode.floor => fixedDecimal.floor,
RoundingMode.expand => fixedDecimal.expand,
RoundingMode.trunc => fixedDecimal.trunc,
RoundingMode.halfCeil => (int position) => fixedDecimal.roundWithMode(
position, icu.FixedDecimalRoundingMode.halfCeil),
RoundingMode.halfFloor => (int position) => fixedDecimal.roundWithMode(
position, icu.FixedDecimalRoundingMode.halfFloor),
RoundingMode.halfExpand => (int position) => fixedDecimal.roundWithMode(
position, icu.FixedDecimalRoundingMode.halfExpand),
RoundingMode.halfTrunc => (int position) => fixedDecimal.roundWithMode(
position, icu.FixedDecimalRoundingMode.halfTrunc),
RoundingMode.halfEven => (int position) => fixedDecimal.roundWithMode(
position, icu.FixedDecimalRoundingMode.halfEven),
RoundingMode.halfCeil => fixedDecimal.halfCeil,
RoundingMode.halfFloor => fixedDecimal.halfFloor,
RoundingMode.halfExpand => fixedDecimal.halfExpand,
RoundingMode.halfTrunc => fixedDecimal.halfTrunc,
RoundingMode.halfEven => fixedDecimal.halfEven,
};
roundingFunction(maxSignificantPosition);
}
Expand Down
2 changes: 1 addition & 1 deletion submodules/icu4x
Submodule icu4x updated 17295 files

0 comments on commit ca3f1ca

Please sign in to comment.