Skip to content
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

locale: Deprecate currency information #3278

Merged
merged 8 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/locale/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
Add second 'dp' argument for decimal places in distance/speed/temp (fix #1523)
0.17: Fix regression where long month names were 'undefined' (fix #1641)
0.18: Fix lint warnings, change anv->janv for fr_BE and fr_CH
0.19: Deprecate currency information
1 change: 0 additions & 1 deletion apps/locale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ other applications or widgets to provide locale-friendly
- Time (12h/24h)
- Days of the Week
- Months
- Currency values
- Distances/Lengths/Speed (metric/imperial)
- Temperature (°C/°F)

Expand Down
8 changes: 2 additions & 6 deletions apps/locale/locale.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@
dateN = dateN.replace(e,"${"+replaceList[e]+"}");
dateS = dateS.replace(e,"${"+replaceList[e]+"}");
});
var currency = locale.currency_first ?
`${js(locale.currency_symbol)} + exports.number(n)`:
`exports.number(n) + ${js(locale.currency_symbol)}`;
var temperature = locale.temperature=='°F' ? '(t*9/5)+32' : 't';

function getLocaleModule(isLocal) {
Expand All @@ -194,7 +191,7 @@
}
exports = {
name: ${js(locale.lang)},
currencySym: ${js(locale.currency_symbol)},
currencySym: ${js("£")},
dow: (d,short) => ${js(locale.day + ',' + locale.abday)}.split(',')[d.getDay() + (short ? 7 : 0)],
month: (d,short) => ${js(locale.month + ',' + locale.abmonth)}.split(',')[d.getMonth() + (short ? 12 : 0)],
number: (n, dec) => {
Expand All @@ -212,7 +209,7 @@
}
return s.substr(0, i + 3) + r + (d ? '${locale.decimal_point}' + d: '');
},
currency: n => ${currency},
currency: n => {console.log("Warning: Currency information is deprecated, see https://github.com/espruino/BangleApps/issues/3269");return ${js("£")}+exports.number(n)},
distance: (n,dp) => n < ${distanceUnits[locale.distance[1]]} ? round(${unitConv(distanceUnits[locale.distance[0]])},dp) + ${js(locale.distance[0])} : round(${unitConv(distanceUnits[locale.distance[1]])},dp) + ${js(locale.distance[1])},
speed: (n,dp) => round(${unitConv(speedUnits[locale.speed])},dp) + ${js(locale.speed)},
temp: (t,dp) => round(${temperature},dp) + ${js(locale.temperature)},
Expand All @@ -236,7 +233,6 @@
<tr><td class="table_t">Date</td><td>${exports.date(date,1)}</td><td>${exports.date(date,0)}</td></tr>
<tr><td class="table_t">Time</td><td>${exports.time(date,1)}</td><td>${exports.time(date,0)}</td></tr>
<tr><td class="table_t">Number</td><td>${exports.number(12.3456789)}</td><td>${exports.number(12.3456789,4)}</td></tr>
<tr><td class="table_t">Currency</td><td></td><td>${exports.currency(12.34)}</td></tr>
<tr><td class="table_t">Distance</td><td>${exports.distance(12.34,0)}</td><td>${exports.distance(12345.6,1)}</td></tr>
<tr><td class="table_t">Speed</td><td></td><td>${exports.speed(123)}</td></tr>
<tr><td class="table_t">Temperature</td><td></td><td>${exports.temp(12,0)}</td></tr>
Expand Down
Loading
Loading