Skip to content

Commit

Permalink
get_translations() cannot return None, remove uncessary checks. (closes
Browse files Browse the repository at this point in the history
#127, closes #126)
  • Loading branch information
TkTech committed Aug 27, 2020
1 parent 1bbd65d commit 07d125a
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions flask_babel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
flaskext.babel
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -593,8 +592,6 @@ def gettext(self, string, **variables):
gettext(u'Hello %(name)s!', name='World')
"""
t = self.get_translations()
if t is None:
return string if not variables else string % variables
s = t.ugettext(string)
return s if not variables else s % variables

Expand All @@ -612,10 +609,6 @@ def ngettext(self, singular, plural, num, **variables):
"""
variables.setdefault('num', num)
t = self.get_translations()
if t is None:
s = singular if num == 1 else plural
return s if not variables else s % variables

s = t.ungettext(singular, plural, num)
return s if not variables else s % variables

Expand All @@ -625,8 +618,6 @@ def pgettext(self, context, string, **variables):
.. versionadded:: 0.7
"""
t = self.get_translations()
if t is None:
return string if not variables else string % variables
s = t.upgettext(context, string)
return s if not variables else s % variables

Expand All @@ -637,9 +628,6 @@ def npgettext(self, context, singular, plural, num, **variables):
"""
variables.setdefault('num', num)
t = self.get_translations()
if t is None:
s = singular if num == 1 else plural
return s if not variables else s % variables
s = t.unpgettext(context, singular, plural, num)
return s if not variables else s % variables

Expand Down

0 comments on commit 07d125a

Please sign in to comment.