Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
9e49d9fb
Commit
9e49d9fb
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Fallback to NumberFormat for Esperanto
parent
8a617c68
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ui/ui_helpers.dart
+12
-5
12 additions, 5 deletions
lib/ui/ui_helpers.dart
with
12 additions
and
5 deletions
lib/ui/ui_helpers.dart
+
12
−
5
View file @
9e49d9fb
...
...
@@ -158,7 +158,7 @@ NumberFormat currentNumberFormat(
{
required
bool
useSymbol
,
required
bool
isG1
,
required
String
locale
})
{
final
NumberFormat
currencyFormatter
=
NumberFormat
.
currency
(
symbol:
useSymbol
?
currentCurrency
(
isG1
)
:
''
,
locale:
locale
,
locale:
eo
(
locale
)
,
decimalDigits:
isG1
?
2
:
3
,
);
return
currencyFormatter
;
...
...
@@ -199,12 +199,19 @@ String formatKAmountInViewWithLocale(
double
convertAmount
(
bool
isG1
,
double
amount
,
double
currentUd
)
=
>
isG1
?
amount
/
100
:
((
amount
/
100
)
/
currentUd
);
// NumberFormat does not work with esperanto nowadays, so we use
// this fallback
// https://en.wikipedia.org/wiki/Decimal_separator
// The three most spoken international auxiliary languages, Ido, Esperanto, and
// Interlingua, all use the comma as the decimal separator.
String
eo
(
String
locale
)
=
>
locale
==
'eo'
?
'es'
:
locale
;
double
parseToDoubleLocalized
(
{
required
String
locale
,
required
String
number
})
=
>
NumberFormat
.
decimalPattern
(
locale
)
.
parse
(
number
)
.
toDouble
();
NumberFormat
.
decimalPattern
(
eo
(
locale
)
)
.
parse
(
number
)
.
toDouble
();
String
localizeNumber
(
BuildContext
context
,
double
amount
)
=
>
NumberFormat
.
decimalPattern
(
currentLocale
(
context
))
.
format
(
amount
);
NumberFormat
.
decimalPattern
(
eo
(
currentLocale
(
context
))
)
.
format
(
amount
);
Future
<
Contact
>
contactFromResultSearch
(
Map
<
String
,
dynamic
>
record
)
async
{
final
Map
<
String
,
dynamic
>
source
=
record
[
'_source'
]
as
Map
<
String
,
dynamic
>
;
...
...
@@ -465,7 +472,7 @@ double calculate({required String textInTerminal, required String decimalSep}) {
}
String
decimalSep
(
BuildContext
context
)
{
return
NumberFormat
.
decimalPattern
(
currentLocale
(
context
))
return
NumberFormat
.
decimalPattern
(
eo
(
currentLocale
(
context
))
)
.
symbols
.
DECIMAL_SEP
;
}
...
...
@@ -502,7 +509,7 @@ String? validateDecimal(
required
String
locale
,
required
String
?
amount
,
required
String
Function
(
String
s
)
tr
})
{
final
NumberFormat
format
=
NumberFormat
.
decimalPattern
(
locale
);
final
NumberFormat
format
=
NumberFormat
.
decimalPattern
(
eo
(
locale
)
)
;
if
(
amount
==
null
||
amount
.
isEmpty
||
amount
.
startsWith
(
sep
))
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
vjrj
@vjrj
mentioned in issue
#87 (closed)
·
1 year ago
mentioned in issue
#87 (closed)
mentioned in issue #87
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment