From 174b7ef6cc3f563f88838421e1ec7c3c9571ef39 Mon Sep 17 00:00:00 2001 From: Emir SARI Date: Thu, 16 Mar 2023 19:43:54 +0300 Subject: [PATCH] ShowImage: Use BNumberFormat for percentage value This provides automatic percentage formatting according to the locale setting. Change-Id: I9a833fdc4056ac5479d8e4b4feddd0fce06d1fcd Reviewed-on: https://review.haiku-os.org/c/haiku/+/6210 Tested-by: Automation Reviewed-by: waddlesplash --- src/apps/showimage/ShowImageStatusView.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apps/showimage/ShowImageStatusView.cpp b/src/apps/showimage/ShowImageStatusView.cpp index 71a10fb68d..327cb1fd17 100644 --- a/src/apps/showimage/ShowImageStatusView.cpp +++ b/src/apps/showimage/ShowImageStatusView.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -178,7 +179,13 @@ ShowImageStatusView::_SetFrameText(const BString& text) void ShowImageStatusView::_SetZoomText(float zoom) { - fCellText[kZoomCell].SetToFormat("%.0f%%", zoom * 100); + BNumberFormat numberFormat; + BString data; + + if (numberFormat.FormatPercent(data, zoom) != B_OK) + fCellText[kZoomCell].SetToFormat("%.0f%%", zoom * 100); + + fCellText[kZoomCell] = data; }