-
-
Notifications
You must be signed in to change notification settings - Fork 14
Update package:intl4x to 1.0.0-alpha.1 for Dart #556
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
Open
mosuem
wants to merge
6
commits into
main
Choose a base branch
from
updateDartv1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
67c75ee
Update package:intl4x to 1.0.0-alpha.1 for Dart
mosuem 1e18d79
update version
mosuem 52e32f1
more cleanups
mosuem 9eee0f1
Add likely_subtags
mosuem 135a93e
setup fixes
mosuem 57a0f56
Merge branch 'main' into updateDartv1
mosuem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import 'package:dart_executor/likely_subtags.dart'; | ||
|
|
||
| void main(List<String> args) { | ||
| testLikelySubtags(args.first); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import 'likely_subtags_native.dart' | ||
| if (dart.library.js_interop) 'likely_subtags_web.dart'; | ||
|
|
||
| String testLikelySubtags(String jsonEncoded) => testLikelySubtagsImpl(jsonEncoded); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import 'dart:convert'; | ||
| import 'package:icu4x/icu4x.dart' as icu; | ||
|
|
||
| String testLikelySubtagsImpl(String jsonEncoded) { | ||
| final json = jsonDecode(jsonEncoded) as Map<String, dynamic>; | ||
| final label = json['label']; | ||
| final localeStr = json['locale'] as String; | ||
| final option = json['option'] as String; | ||
|
|
||
| final returnJson = <String, dynamic>{'label': label}; | ||
|
|
||
| try { | ||
| final locale = icu.Locale.fromString(localeStr); | ||
| final expander = icu.LocaleExpander.extended(); | ||
|
|
||
| if (option == 'maximize') { | ||
| expander.maximize(locale); | ||
| } else if (option == 'minimize' || option == 'minimizeFavorRegion') { | ||
| expander.minimize(locale); | ||
| } else if (option == 'minimizeFavorScript') { | ||
| expander.minimizeFavorScript(locale); | ||
| } else { | ||
| returnJson['error_type'] = 'unsupported'; | ||
| returnJson['unsupported'] = 'Unknown option: $option'; | ||
| return jsonEncode(returnJson); | ||
| } | ||
|
|
||
| returnJson['result'] = locale.toString(); | ||
| } catch (e) { | ||
| returnJson['error'] = e.toString(); | ||
| } | ||
|
|
||
| return jsonEncode(returnJson); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import 'dart:convert'; | ||
| import 'dart:js_interop'; | ||
|
|
||
| @JS('Intl.Locale') | ||
| extension type _LocaleJS._(JSObject _) implements JSObject { | ||
| external factory _LocaleJS(String s); | ||
| external _LocaleJS minimize(); | ||
| external _LocaleJS maximize(); | ||
| external String get baseName; | ||
| } | ||
|
|
||
| String testLikelySubtagsImpl(String jsonEncoded) { | ||
| final json = jsonDecode(jsonEncoded) as Map<String, dynamic>; | ||
| final label = json['label']; | ||
| final localeStr = json['locale'] as String; | ||
| final option = json['option'] as String; | ||
|
|
||
| final returnJson = <String, dynamic>{'label': label}; | ||
|
|
||
| try { | ||
| final locale = _LocaleJS(localeStr); | ||
| if (option == 'maximize') { | ||
| returnJson['result'] = locale.maximize().baseName; | ||
| } else if (option == 'minimize' || option == 'minimizeFavorRegion') { | ||
| returnJson['result'] = locale.minimize().baseName; | ||
| } else { | ||
| returnJson['error_type'] = 'unsupported'; | ||
| returnJson['unsupported'] = 'Option $option not supported on web'; | ||
| return jsonEncode(returnJson); | ||
| } | ||
| } catch (e) { | ||
| returnJson['error'] = e.toString(); | ||
| } | ||
|
|
||
| return jsonEncode(returnJson); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| /// This file is autogenerated by bin/set_version.dart, do not modify manually. | ||
| const intl4xVersion = '0.17.0'; | ||
| const intl4xVersion = '1.0.0-alpha.1'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| var tools = require('./likely_subtagsDart'); | ||
| module.exports = { | ||
| testLikelySubtags: function (json) { | ||
| return JSON.parse(tools.testLikelySubtags(JSON.stringify(json))); | ||
| } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| const dartVersion = "0.17.0"; | ||
| const dartVersion = "1.0.0-alpha.1"; | ||
| module.exports = { dartVersion }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.