Skip to content

Commit

Permalink
⚡ Deprecate number formatting
Browse files Browse the repository at this point in the history
This was a minor convenience feature but out of scope for MVP. Needs refactoring for future usage in plugin.
  • Loading branch information
ivov committed Dec 20, 2021
1 parent f0bc2eb commit 23e4a9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/editor-ui/src/components/mixins/genericHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ export const genericHelpers = mixins(showMessage).extend({
displayTimer (msPassed: number, showMs = false): string {
if (msPassed < 60000) {
if (showMs === false) {
return `${this.$locale.number(Math.floor(msPassed / 1000), 'decimal')} ${this.$locale.baseText('genericHelpers.sec')}`;
return `${Math.floor(msPassed / 1000)} ${this.$locale.baseText('genericHelpers.sec')}`;
}

return `${this.$locale.number(msPassed / 1000, 'decimal')} ${this.$locale.baseText('genericHelpers.sec')}`;
return `${msPassed / 1000} ${this.$locale.baseText('genericHelpers.sec')}`;
}

const secondsPassed = Math.floor(msPassed / 1000);
const minutesPassed = Math.floor(secondsPassed / 60);
const secondsLeft = (secondsPassed - (minutesPassed * 60)).toString().padStart(2, '0');

return `${this.$locale.number(minutesPassed, 'decimal')}:${this.$locale.number(secondsPassed, 'decimal')} ${this.$locale.baseText('genericHelpers.min')}`;
return `${minutesPassed}:${secondsLeft} ${this.$locale.baseText('genericHelpers.min')}`;
},
editAllowedCheck (): boolean {
if (this.isReadOnly) {
Expand Down
3 changes: 2 additions & 1 deletion packages/editor-ui/src/plugins/i18n/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ As a convenience, the base text file may contain the special key `reusableBaseTe
},
```

<!--
As a convenience, the base text file may also contain the special key `numberFormats` to localize numbers. For more information, refer to Vue i18n's [number localization](https://kazupon.github.io/vue-i18n/guide/number.html#number-localization).

```json
Expand All @@ -87,7 +88,7 @@ As a convenience, the base text file may also contain the special key `numberFor
},
},
}
```
``` -->

#### Interpolation

Expand Down

0 comments on commit 23e4a9f

Please sign in to comment.