Skip to content

Commit

Permalink
Fixed numeric locales.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Sep 9, 2024
1 parent 5e03fdf commit 8cbd17b
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 63 deletions.
13 changes: 3 additions & 10 deletions bin/python/po_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ def translate_with_google(self, english):
if self.have_seen.get(english, None):
return self.have_seen[english]

if len(english) < 4:
return english

if self.is_number(english):
if len(english) < 4 and not self.is_number(english):
return english

if not self.use_google:
Expand All @@ -281,10 +278,7 @@ def _translate_text(self, english):
if english in DONT_TRANSLATE:
return english

if len(english) < 4:
return english

if self.is_number(english):
if len(english) < 4 and not self.is_number(english):
return english

translated_text = self.have_seen.get(english, None)
Expand Down Expand Up @@ -345,8 +339,7 @@ def translate_text(self, english):

translated_text = self._translate_text(english)
if 'QUERY LENGTH' in translated_text:
print('\t********FAILED********')
return english
return '********FAILED********'
translated_text = translated_text.replace('Mrv2', 'mrv2')
print(f"\tTranslated: {translated_text}")
return translated_text
Expand Down
4 changes: 4 additions & 0 deletions src/docs/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ v1.2.7
was previously open.
- Fixed HDR->Auto Normalize with OpenEXR files that had a smaller display
window.
- Fixed FPS display not respecting the decimal separator on numeric locales
that use commas.
- Fixed numeric locale for Hindi.
- Fixed numeric locale for all languages.


v1.2.6
Expand Down
7 changes: 2 additions & 5 deletions src/lib/mrvFl/mrvLanguages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,15 @@ namespace mrv

initLocale(language);

const char* numericLocale = setlocale(LC_ALL, NULL);

#if defined __APPLE__ && defined __MACH__
numericLocale = setlocale(LC_MESSAGES, NULL);
#endif
const char* numericLocale = language;
if (language)
{
// This is for Apple mainly, as it we just set LC_MESSAGES only
// and not the numeric locale, which we must set separately for
// those locales that use periods in their floating point.
if (strcmp(language, "C") == 0 || strncmp(language, "ar", 2) == 0 ||
strncmp(language, "en", 2) == 0 ||
strncmp(language, "hi", 2) == 0 ||
strncmp(language, "ja", 2) == 0 ||
strncmp(language, "ko", 2) == 0 ||
strncmp(language, "zh", 2) == 0)
Expand Down
38 changes: 22 additions & 16 deletions src/lib/mrvWidgets/mrvFPSInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,34 @@

#include <mrvWidgets/mrvFPSInput.h>

namespace mrv
namespace
{
namespace decimal
double floorToOnePlace(double number)
{
double floorToOnePlace(double number)
{
// Multiply by 10, floor to the nearest integer,
// and then divide by 10
return std::floor(number * 10.0) / 10.0;
}
} // namespace decimal
// Multiply by 10, floor to the nearest integer,
// and then divide by 10
return std::floor(number * 10.0) / 10.0;
}
}


namespace mrv
{
int FPSInput::format(char* buffer)
{
std::stringstream ss;
char temp[64];
int length;

double number = value();
double rounded = decimal::floorToOnePlace(number);
if (w() < 52)
ss << rounded;
else
ss << number;
return snprintf(buffer, 128, "%s", ss.str().c_str());

if (w() < 52.0) {
length = sprintf(temp, "%.1f", floorToOnePlace(number));
} else {
length = sprintf(temp, "%.3f", number);
}

strcpy(buffer, temp);
return length;
}

void FPSInput::resize(int X, int Y, int W, int H)
Expand Down
22 changes: 11 additions & 11 deletions src/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -5051,7 +5051,7 @@ msgid "60"
msgstr "60"

msgid "59.952"
msgstr "59.952"
msgstr "59,952"

msgid "50"
msgstr "50"
Expand All @@ -5060,13 +5060,13 @@ msgid "48"
msgstr "48"

msgid "47.952"
msgstr "47.952"
msgstr "47,952"

msgid "30"
msgstr "30"

msgid "29.976"
msgstr "29.976"
msgstr "29,976"

msgid "25"
msgstr "25"
Expand All @@ -5075,22 +5075,22 @@ msgid "24"
msgstr "24"

msgid "23.976"
msgstr "23.976"
msgstr "23,976"

msgid "15"
msgstr "15"

msgid "14.988"
msgstr "14.988"
msgstr "14,988"

msgid "12.5"
msgstr "12.5"
msgstr "12,5"

msgid "12"
msgstr "12"

msgid "11.988"
msgstr "11.988"
msgstr "11,988"

msgid "F:"
msgstr "F:"
Expand Down Expand Up @@ -5349,7 +5349,7 @@ msgid "B44A"
msgstr "B44A"

msgid "DWAA"
msgstr "L 347 vom 20.12.2013, S. 671."
msgstr "DWAA"

msgid "DWAB"
msgstr "DWAB"
Expand Down Expand Up @@ -5499,13 +5499,13 @@ msgid "Large"
msgstr "Gro"

msgid "59.94"
msgstr "59.94"
msgstr "59.94............................................................................................................................................................................................................................................................."

msgid "29.97"
msgstr "29.97"
msgstr "29.97.............................................................................................................................................................................................................................................................."

msgid "14.985"
msgstr "14.985"
msgstr "14,985"

msgid "Loop"
msgstr "Schleife"
Expand Down
14 changes: 7 additions & 7 deletions src/po/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -5045,7 +5045,7 @@ msgid "60"
msgstr "60"

msgid "59.952"
msgstr "59.952"
msgstr "59,952"

msgid "50"
msgstr "50"
Expand All @@ -5054,13 +5054,13 @@ msgid "48"
msgstr "48"

msgid "47.952"
msgstr "47.952"
msgstr "47,952"

msgid "30"
msgstr "30"

msgid "29.976"
msgstr "29.976"
msgstr "29,976"

msgid "25"
msgstr "25"
Expand All @@ -5069,22 +5069,22 @@ msgid "24"
msgstr "24"

msgid "23.976"
msgstr "23.976"
msgstr "23,976"

msgid "15"
msgstr "15"

msgid "14.988"
msgstr "14.988"
msgstr "14,988"

msgid "12.5"
msgstr "12.5"
msgstr "12,5"

msgid "12"
msgstr "12"

msgid "11.988"
msgstr "11.988"
msgstr "11,988"

msgid "F:"
msgstr "F:"
Expand Down
14 changes: 7 additions & 7 deletions src/po/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -5054,7 +5054,7 @@ msgid "60"
msgstr "60"

msgid "59.952"
msgstr "59.952"
msgstr "59,952"

msgid "50"
msgstr "50"
Expand All @@ -5063,13 +5063,13 @@ msgid "48"
msgstr "48"

msgid "47.952"
msgstr "47.952"
msgstr "47,952"

msgid "30"
msgstr "30"

msgid "29.976"
msgstr "29.976"
msgstr "29,976"

msgid "25"
msgstr "25"
Expand All @@ -5078,22 +5078,22 @@ msgid "24"
msgstr "24"

msgid "23.976"
msgstr "23.976"
msgstr "23,976"

msgid "15"
msgstr "15"

msgid "14.988"
msgstr "14.988"
msgstr "14,988"

msgid "12.5"
msgstr "12.5"
msgstr "12,5"

msgid "12"
msgstr "12"

msgid "11.988"
msgstr "11.988"
msgstr "11,988"

msgid "F:"
msgstr "F:"
Expand Down
14 changes: 7 additions & 7 deletions src/po/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -5020,7 +5020,7 @@ msgid "60"
msgstr "60"

msgid "59.952"
msgstr "59.952"
msgstr "59,952"

msgid "50"
msgstr "50"
Expand All @@ -5029,13 +5029,13 @@ msgid "48"
msgstr "48"

msgid "47.952"
msgstr "47.952"
msgstr "47,952"

msgid "30"
msgstr "30"

msgid "29.976"
msgstr "29.976"
msgstr "29,976"

msgid "25"
msgstr "25"
Expand All @@ -5044,22 +5044,22 @@ msgid "24"
msgstr "24"

msgid "23.976"
msgstr "23.976"
msgstr "23,976"

msgid "15"
msgstr "15"

msgid "14.988"
msgstr "14.988"
msgstr "14,988"

msgid "12.5"
msgstr "12.5"
msgstr "12,5"

msgid "12"
msgstr "12"

msgid "11.988"
msgstr "11.988"
msgstr "11,988"

msgid "F:"
msgstr "F:"
Expand Down

0 comments on commit 8cbd17b

Please sign in to comment.