diff --git a/ffgo/fgdata/airport.py b/ffgo/fgdata/airport.py index 62ec6a0..bc3311b 100644 --- a/ffgo/fgdata/airport.py +++ b/ffgo/fgdata/airport.py @@ -106,11 +106,11 @@ def tooltipText(self): _("Latitude: {latitude}").format(latitude=self.lat), _("Longitude: {longitude}").format(longitude=self.lon), _("Elevation: {elev_feet} ft ({elev_meters} m)").format( - elev_feet=locale.format("%d", round(self.elevation)), - elev_meters=locale.format("%.01f", self.elevation*0.3048))] + elev_feet=locale.format_string("%d", round(self.elevation)), + elev_meters=locale.format_string("%.01f", self.elevation*0.3048))] if magField is not None: - magVar = locale.format("%.01f", magField.decl(self.lat, self.lon)) + magVar = locale.format_string("%.01f", magField.decl(self.lat, self.lon)) l.append(_("Magnetic variation: {}°").format(magVar)) return '\n'.join(l + rl) @@ -370,7 +370,7 @@ def __str__(self): return "{} ({})".format(self.name, self.type) def formatLength(self, val): - return locale.format("%d", round(val)) + return locale.format_string("%d", round(val)) def _addLatitude(self, l): if self.lat is not None: @@ -428,7 +428,7 @@ def _addRunwayMarkings(self, l): def _addSmoothness(self, l): if self.smoothness is not None: l.append(_("Smoothness: {}").format( - locale.format("%.02f", self.smoothness))) + locale.format_string("%.02f", self.smoothness))) class LandRunway(RunwayBase): diff --git a/ffgo/fgdata/parking.py b/ffgo/fgdata/parking.py index f510b4c..a6cd39f 100644 --- a/ffgo/fgdata/parking.py +++ b/ffgo/fgdata/parking.py @@ -154,9 +154,9 @@ def tooltipText(self): l = [] if abs(self.radius - round(self.radius)) < 0.01: - radiusStr = locale.format("%d", round(self.radius)) + radiusStr = locale.format_string("%d", round(self.radius)) else: - radiusStr = locale.format("%.02f", self.radius) + radiusStr = locale.format_string("%.02f", self.radius) l.append( pgettext('parking position', 'Radius: {} m').format(radiusStr)) diff --git a/ffgo/gui/gps_tool.py b/ffgo/gui/gps_tool.py index 3699187..2fdb17e 100644 --- a/ffgo/gui/gps_tool.py +++ b/ffgo/gui/gps_tool.py @@ -406,7 +406,7 @@ def __init__(self, master, config, app): ToolTip(flightDurationPostfixLabel, _("Decomposition using Julian years\n" "(1 Julian year = {days} days)").format( - days=locale.format("%.02f", 365.25, grouping=True))) + days=locale.format_string("%.02f", 365.25, grouping=True))) # This causes the initialization of the various fields of the dialog # because of the TreeviewSelect event generated by the initial airport @@ -739,22 +739,22 @@ def decomposeMinutes(self, nMin): if years: l.append(_("{nYears} {years}").format( - nYears=locale.format("%d", years, grouping=True), + nYears=locale.format_string("%d", years, grouping=True), years=ngettext("year", "years", years))) if days: l.append(_("{nDays} {days}").format( - nDays=locale.format("%d", days, grouping=True), + nDays=locale.format_string("%d", days, grouping=True), days=ngettext("day", "days", days))) if hours: l.append(_("{nHours} {hours}").format( - nHours=locale.format("%d", hours, grouping=True), + nHours=locale.format_string("%d", hours, grouping=True), hours=ngettext("hour", "hours", hours))) if minutes: l.append(_("{nMinutes} {minutes}").format( - nMinutes=locale.format("%d", minutes, grouping=True), + nMinutes=locale.format_string("%d", minutes, grouping=True), minutes=ngettext("minute", "minutes", minutes))) if len(l) >= 2: @@ -766,7 +766,7 @@ def decomposeMinutes(self, nMin): # Use the same expression as above for uniformity and to avoid # creating useless work for translations res = _("{nMinutes} {minutes}").format( - nMinutes=locale.format("%d", 0, grouping=True), + nMinutes=locale.format_string("%d", 0, grouping=True), minutes=ngettext("minute", "minutes", minutes)) return res diff --git a/ffgo/gui/pressure_converter.py b/ffgo/gui/pressure_converter.py index 35dbaf5..01a8d43 100644 --- a/ffgo/gui/pressure_converter.py +++ b/ffgo/gui/pressure_converter.py @@ -161,8 +161,8 @@ def addVertSpacer(container, rowNum, colNum=0, ToolTip(stdButton, _("Set the standard pressure\n" "({std_hPa} hPa = {std_inHg} inHg)").format( - std_hPa=locale.format("%.02f", 1013.25), - std_inHg=locale.format("%.02f", 29.92))) + std_hPa=locale.format_string("%.02f", 1013.25), + std_inHg=locale.format_string("%.02f", 29.92))) # ----- Close button ---------------------------------------------------------- self.buttonFrame = self._newWidget( @@ -220,7 +220,7 @@ def updateHPaValue(self, *args): if not inHg.strip(): self.hPa.set('') else: - self.hPa.set(locale.format("%.02f", locale.atof(inHg)*33.8639)) + self.hPa.set(locale.format_string("%.02f", locale.atof(inHg)*33.8639)) # Accept any arguments to allow safe use as a Tkinter variable observer def updateRoundedHPa(self, *args): @@ -247,12 +247,12 @@ def updateInHg(self, *args): if not hPa.strip(): self.inHg.set('') else: - self.inHg.set(locale.format("%.02f", locale.atof(hPa)*0.02953)) + self.inHg.set(locale.format_string("%.02f", locale.atof(hPa)*0.02953)) def setStandardValues(self): # This will cause the value in inHg as well as the rounded hPa # value to be updated. - self.hPa.set(locale.format("%.02f", 1013.25)) + self.hPa.set(locale.format_string("%.02f", 1013.25)) def show(self): """Make sure the Pressure Converter dialog is visible.""" diff --git a/ffgo/misc.py b/ffgo/misc.py index 5368b64..2c70876 100644 --- a/ffgo/misc.py +++ b/ffgo/misc.py @@ -105,7 +105,7 @@ class DecimalCoord(float): def __str__(self): # 8 decimal places, as recommended for latitudes and longitudes in # the apt.dat v1000 spec - return locale.format("%.08f", self) + return locale.format_string("%.08f", self) def __repr__(self): return "{}.{}({!r})".format(__name__, type(self).__name__, float(self))