Browse Source

[fix] add missing localizable (gettext) messages to searxng.msg

To test this patch I used .. and checked the diff of the `messages.pot` file::

    $ ./manage pyenv.cmd pybabel extract -F babel.cfg \
              -o ./searx/translations/messages.pot searx/
    $ git diff ./searx/translations/messages.pot

----

hint from @dalf: f-string are not supported [1] but there is no error [2].

[1] python-babel/babel#594
[2] python-babel/babel#715

Closes: https://github.com/searxng/searxng/issues/3412
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 1 year ago
parent
commit
ddaa6ed759
2 changed files with 39 additions and 1 deletions
  1. 1 1
      searx/engines/yummly.py
  2. 38 0
      searx/searxng.msg

+ 1 - 1
searx/engines/yummly.py

@@ -68,7 +68,7 @@ def response(resp):
                 'title': result['display']['displayName'],
                 'content': content,
                 'img_src': img_src,
-                'metadata': f"{gettext('Language')}: {result['locale'].split('-')[0]}",
+                'metadata': gettext('Language') + f": {result['locale'].split('-')[0]}",
             }
         )
 

+ 38 - 0
searx/searxng.msg

@@ -12,6 +12,8 @@ __all__ = [
     'CATEGORY_GROUPS',
     'STYLE_NAMES',
     'BRAND_CUSTOM_LINKS',
+    'WEATHER_TERMS',
+    'SOCIAL_MEDIA_TERMS',
 ]
 
 CONSTANT_NAMES = {
@@ -27,6 +29,8 @@ CATEGORY_NAMES = {
     'SOCIAL_MEDIA': 'social media',
     'IMAGES': 'images',
     'VIDEOS': 'videos',
+    'RADIO': 'radio',
+    'TV': 'tv',
     'IT': 'it',
     'NEWS': 'news',
     'MAP': 'map',
@@ -57,3 +61,37 @@ BRAND_CUSTOM_LINKS = {
     'UPTIME': 'Uptime',
     'ABOUT': 'About',
 }
+
+WEATHER_TERMS = {
+    'AVERAGE TEMP.': 'Average temp.',
+    'CLOUD COVER': 'Cloud cover',
+    'CONDITION': 'Condition',
+    'CURRENT CONDITION': 'Current condition',
+    'EVENING': 'Evening',
+    'FEELS LIKE': 'Feels like',
+    'HUMIDITY': 'Humidity',
+    'MAX TEMP.': 'Max temp.',
+    'MIN TEMP.': 'Min temp.',
+    'MORNING': 'Morning',
+    'NIGHT': 'Night',
+    'NOON': 'Noon',
+    'PRESSURE': 'Pressure',
+    'SUNRISE': 'Sunrise',
+    'SUNSET': 'Sunset',
+    'TEMPERATURE': 'Temperature',
+    'UV INDEX': 'UV index',
+    'VISIBILITY': 'Visibility',
+    'WIND': 'Wind',
+}
+
+SOCIAL_MEDIA_TERMS = {
+    'SUBSCRIBERS': 'subscribers',
+    'POSTS': 'posts',
+    'ACTIVE USERS': 'active users',
+    'COMMENTS': 'comments',
+    'USER': 'user',
+    'COMMUNITY': 'community',
+    'POINTS': 'points',
+    'TITLE': 'title',
+    'AUTHOR': 'author',
+}