webapp: Added additional locale specific formatting

This commit is contained in:
Thomas Basler 2023-01-02 15:37:11 +01:00
parent a88687eae6
commit d7532e407e
6 changed files with 19 additions and 11 deletions

View File

@ -13,7 +13,7 @@
</tr> </tr>
<tr> <tr>
<td>{{ $t('devinfo.DetectedMaxPower') }}</td> <td>{{ $t('devinfo.DetectedMaxPower') }}</td>
<td>{{ devInfoList.max_power }} W</td> <td>{{ $n(devInfoList.max_power, 'decimal') }} W</td>
</tr> </tr>
<tr> <tr>
<td>{{ $t('devinfo.BootloaderVersion') }}</td> <td>{{ $t('devinfo.BootloaderVersion') }}</td>

View File

@ -41,7 +41,7 @@
</tr> </tr>
<tr> <tr>
<th>{{ $t('firmwareinfo.ConfigSaveCount') }}</th> <th>{{ $t('firmwareinfo.ConfigSaveCount') }}</th>
<td>{{ systemStatus.cfgsavecount }}</td> <td>{{ $n(systemStatus.cfgsavecount, 'decimal') }}</td>
</tr> </tr>
<tr> <tr>
<th>{{ $t('firmwareinfo.Uptime') }}</th> <th>{{ $t('firmwareinfo.Uptime') }}</th>

View File

@ -5,16 +5,15 @@
<div class="progress"> <div class="progress">
<div class="progress-bar" role="progressbar" :style="{ width: getPercent() + '%' }" <div class="progress-bar" role="progressbar" :style="{ width: getPercent() + '%' }"
v-bind:aria-valuenow="getPercent()" aria-valuemin="0" aria-valuemax="100"> v-bind:aria-valuenow="getPercent()" aria-valuemin="0" aria-valuemax="100">
{{ getPercent() }}% {{ $n(getPercent() / 100, 'percent') }}
</div> </div>
</div> </div>
</td> </td>
<td class="rightCell"> <td class="rightCell">
{{ Math.round((total - used) / 1024) }} {{ $n(Math.round((total - used) / 1024), 'kilobyte') }}
KByte
</td> </td>
<td class="rightCell">{{ Math.round(used / 1024) }} KByte</td> <td class="rightCell">{{ $n(Math.round(used / 1024), 'kilobyte') }}</td>
<td class="rightCell">{{ Math.round(total / 1024) }} KByte</td> <td class="rightCell">{{ $n(Math.round(total / 1024), 'kilobyte') }}</td>
</tr> </tr>
</template> </template>

View File

@ -19,7 +19,7 @@
</tr> </tr>
<tr> <tr>
<th>{{ $t('wifiapinfo.Stations') }}</th> <th>{{ $t('wifiapinfo.Stations') }}</th>
<td>{{ networkStatus.ap_stationnum }}</td> <td>{{ $n(networkStatus.ap_stationnum, 'decimal') }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -19,11 +19,11 @@
</tr> </tr>
<tr> <tr>
<th>{{ $t('wifistationinfo.Quality') }}</th> <th>{{ $t('wifistationinfo.Quality') }}</th>
<td>{{ getRSSIasQuality(networkStatus.sta_rssi) }} %</td> <td>{{ $n(getRSSIasQuality(networkStatus.sta_rssi), 'percent') }}</td>
</tr> </tr>
<tr> <tr>
<th>{{ $t('wifistationinfo.Rssi') }}</th> <th>{{ $t('wifistationinfo.Rssi') }}</th>
<td>{{ networkStatus.sta_rssi }}</td> <td>{{ $n(networkStatus.sta_rssi, 'decimal') }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -55,7 +55,7 @@ export default defineComponent({
quality = 2 * (rssi + 100); quality = 2 * (rssi + 100);
} }
return quality; return quality / 100;
}, },
}, },
}); });

View File

@ -71,6 +71,9 @@ export const numberFormats: I18nOptions["numberFormats"] = {
percent: { percent: {
style: 'percent', style: 'percent',
}, },
kilobyte: {
style: 'unit', unit: 'kilobyte',
},
}, },
[Locales.DE]: { [Locales.DE]: {
decimal: { decimal: {
@ -85,6 +88,9 @@ export const numberFormats: I18nOptions["numberFormats"] = {
percent: { percent: {
style: 'percent', style: 'percent',
}, },
kilobyte: {
style: 'unit', unit: 'kilobyte',
},
}, },
[Locales.FR]: { [Locales.FR]: {
decimal: { decimal: {
@ -99,6 +105,9 @@ export const numberFormats: I18nOptions["numberFormats"] = {
percent: { percent: {
style: 'percent', style: 'percent',
}, },
kilobyte: {
style: 'unit', unit: 'kilobyte',
},
}, },
}; };