Skip to content

Commit

Permalink
Fix updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Jul 22, 2024
1 parent 93c96ce commit 69a4fb3
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 13 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/intl4x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,31 @@ jobs:
- run: dart --enable-experiment=native-assets pub get

- run: dart --enable-experiment=native-assets test


build_fetch_local:
runs-on: ${{ matrix.os }}

env:
ICU4X_BUILD_MODE: fetch

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

defaults:
run:
working-directory: pkgs/intl4x

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
submodules: true

- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
with:
sdk: dev

- run: dart --enable-experiment=native-assets pub get

- run: dart --enable-experiment=native-assets test
1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/Bcp47ToIanaMapper.g.dart

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/CalendarError.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/DataError.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/FixedDecimalLimitError.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/FixedDecimalParseError.g.dart
1 change: 0 additions & 1 deletion pkgs/intl4x/lib/src/bindings/IanaToBcp47Mapper.g.dart

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/LocaleParseError.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/MeasureUnit.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/MeasureUnitParser.g.dart

This file was deleted.

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

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/TimeZoneIdMapper.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/TimeZoneInvalidIdError.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/UnitsConverter.g.dart
1 change: 1 addition & 0 deletions pkgs/intl4x/lib/src/bindings/UnitsConverterFactory.g.dart
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.IanaToBcp47Mapper(_data);
final ianaToBcp47Mapper = icu.TimeZoneIdMapper(_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.region = region!;
if (script != null) icu4xLocale.script = script!;
if (region != null) icu4xLocale.setRegion(region!);
if (script != null) icu4xLocale.setScript(script!);
return icu4xLocale;
}
}
17 changes: 11 additions & 6 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.fromDoubleWithDoublePrecision(d),
final double d => icu.FixedDecimal.fromDoubleWithFloatingPrecision(d),
final String s => icu.FixedDecimal.fromString(s),
Object() => icu.FixedDecimal.fromString(number.toString()),
};
Expand Down Expand Up @@ -103,11 +103,16 @@ class NumberFormat4X extends NumberFormatImpl {
RoundingMode.floor => fixedDecimal.floor,
RoundingMode.expand => fixedDecimal.expand,
RoundingMode.trunc => fixedDecimal.trunc,
RoundingMode.halfCeil => fixedDecimal.halfCeil,
RoundingMode.halfFloor => fixedDecimal.halfFloor,
RoundingMode.halfExpand => fixedDecimal.halfExpand,
RoundingMode.halfTrunc => fixedDecimal.halfTrunc,
RoundingMode.halfEven => fixedDecimal.halfEven,
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),
};
roundingFunction(maxSignificantPosition);
}
Expand Down

0 comments on commit 69a4fb3

Please sign in to comment.