Repository: pwr-Solaar/Solaar

Issue:
Various strings are missing from solaar.pot
**Information**
<!-- Make sure that your issue is not one of the known issues in the Solaar documentation at https://pwr-solaar.github.io/Solaar/ -->
<!-- Do not bother opening an issue for a version older than 1.0.6.  Please update to the latest version and see if your issue persists. -->
- Solaar version: solaar 1.0.6
- Distribution: Linux Mint 20.2
- Kernel version: Linux 5.11.0-25-generic x86_64 GNU/Linux
- Output of `solaar show`:

<details>

```
Unifying Receiver
  Device path  : /dev/hidraw0
  USB id       : 046d:C52B
  Serial       : D52CAD33
    Firmware   : 24.10.B0036
    Bootloader : 01.08
    Other      : AA.AD
  Has 1 paired device(s) out of a maximum of 6.
  Notifications: wireless, software present (0x000900)
  Device activity counters: 2=99

  2: Wireless Mouse M545/M546
     Device path  : /dev/hidraw1
     WPID         : 4052
     Codename     : M545/M546
     Kind         : mouse
     Protocol     : HID++ 4.5
     Polling rate : 8 ms (125Hz)
     Serial number: D52CAD33
     Model ID:      405200000000
     Unit ID:       D52CAD33
          Firmware: RQM 63.00.B0010
     The power switch is located on the base.
     Supports 22 HID++ 2.0 features:
         0: ROOT                   {0000}   
         1: FEATURE SET            {0001}   
         2: DEVICE FW VERSION      {0003}   
            Firmware: Firmware RQM 63.00.B0010 4052
            Unit ID: D52CAD33  Model ID: 405200000000  Transport IDs: {'wpid': '4052'}
         3: DEVICE NAME            {0005}   
            Name: Wireless Mouse M545/M546
            Kind: mouse
         4: RESET                  {0020}   
         5: BATTERY STATUS         {1000}   
            Battery: 70%, discharging, next level 5%.
         6: DEVICE RESET           {1802}   internal, hidden
         7: unknown:1810           {1810}   internal, hidden
         8: unknown:1830           {1830}   internal, hidden
         9: unknown:1862           {1862}   internal, hidden
        10: unknown:1890           {1890}   internal, hidden
        11: unknown:18A0           {18A0}   internal, hidden
        12: unknown:18B1           {18B1}   internal, hidden
        13: REPROG CONTROLS V4     {1B04}   
            Czynności klawiszy/przycisków (saved): {'80': 80, '81': 81, '82': 82, '83': 83, '86': 86, '91': 91, '93': 93}
            Czynności klawiszy/przycisków        : {'80': 80, '81': 81, '82': 82, '91': 91, '93': 93, '83': 83, '86': 86}
        14: WIRELESS DEVICE STATUS {1D4B}   
        15: REMAINING PAIRING      {1DF0}   hidden
            Remaining Pairings: 128
        16: unknown:1DF3           {1DF3}   internal, hidden
        17: unknown:1E00           {1E00}   hidden
        18: unknown:1EB0           {1EB0}   internal, hidden
        19: unknown:1F03           {1F03}   internal, hidden
        20: HIRES WHEEL            {2121}   
            Multiplier: 4
            Has invert: Normal wheel motion
            Low resolution mode
            HID notification
            Kierunek kółka przewijania (saved): False
            Kierunek kółka przewijania        : False
            Rozdzielczość kółka przewijania (saved): False
            Rozdzielczość kółka przewijania        : False
        21: POINTER SPEED          {2205}   
            Pointer Speed: 1.0
            Czułość (prędkość wskaźnika) (saved): 256
            Czułość (prędkość wskaźnika)        : 256
     Has 7 reprogrammable keys:
         0: Left Button               , default: Left Click                  => Left Click                
             mse, divertable, pos:0, group:1, group mask:g1
             reporting: default
         1: Right Button              , default: Right Click                 => Right Click               
             mse, divertable, pos:0, group:1, group mask:g1
             reporting: analytics key events reporting
         2: Middle Button             , default: Mouse Middle Button         => Mouse Middle Button       
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: unknown:000200
         3: Left Tilt                 , default: Mouse Scroll Left Button    => Mouse Scroll Left Button  
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: analytics key events reporting, unknown:000200
         4: Right Tilt                , default: Mouse Scroll Right Button   => Mouse Scroll Right Button 
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: unknown:000400
         5: Back Button               , default: Mouse Back Button           => Mouse Back Button         
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: analytics key events reporting, unknown:000400
         6: Forward Button            , default: Mouse Forward Button        => Mouse Forward Button      
             mse, reprogrammable, divertable, raw XY, pos:0, group:2, group mask:g1,g2
             reporting: unknown:000600
     Battery: 70%, discharging, next level 5%.




```
</details>

**Describe the bug**
Some strings are in English only, they cannot be translated as they are not present in translation files, including solaar.pot

**To Reproduce**
Steps to reproduce the behavior:
1. Use a non-English locale (with 100% translated Solaar)
2. Launch Solaar
3. See some strings (labels, tooltips) in English

**Screenshots**
![1](https://user-images.githubusercontent.com/3577122/128511353-a9e45237-bf36-4974-bc46-3a85fb54fd60.png)
![2](https://user-images.githubusercontent.com/3577122/128509175-31bba45a-e8f8-49a6-a6d8-123556580b8e.png)




Discussion:
Thanks, for working on Solaar translations.  It is greatly appreciated.

I went through and tagged some of these as translatable strings.  I also tagged a few more.    The tooltips should be translatable.  Do they show up in the po file?

Some of the strings are Logitech names for devices and keys.  Should they be translated?  There are a lot of them (several hundred key names - see lib/logitech_receiver/special_keys.py).  

Maybe just the names of devices should be translatable, as there are not so many of these.  But some device names are not in code but come from data stored on the device itself.  I'm not sure how they would be translated.

Please check out PR #1221 - it has more strings marked as translatable.  Suggestions on how to handle device and key names are welcome.




To download and work with Solar
```
git clone https://github.com/pwr-Solaar/Solaar.git
cd Solaar
```
Run Solaar as bin/solaar from this directory.


To run PR #1221, first clone Solaar if you have not already done so and cd to the clone directory.  The first time you download the pull request, fetch it into a new branch and checkout that branch, as in:
```
git fetch origin pull/1221/head:pull_1221
git checkout pull_1221
```
To download a new version of the pull request, fetch it and then set your pull branch
to the new fetch, as in:
```
git checkout pull_1221
git fetch origin pull/1221/head
git reset --hard FETCH_HEAD
```


"Mouse Gestures", its tooltip "Send a gesture by sliding the mouse while holding the button down." and padlock's tooltips: "Changes allowed", "No changes allowed", "Ignore this setting" seem to be missing.

The names of devices are translated in Logitech Unifying Software:
![3](https://user-images.githubusercontent.com/3577122/128520363-4f978679-7c99-44de-9dd2-409d8db9c51d.png)

I'm not sure about the key names. There are indeed a lot of them and some of them are rather cryptic. Maybe translate only the most common ones.


I see "Changes allowed" in the po files.  Did you update them as described in i18n.md document, after changing to PR #1221?   (They should be updated when a release is made, but sometimes that isn't done.)

I expect that Logitech includes translations of device names in its software.  That's a bit beyond the resources of the Solaar project.  

I'll think about setting up translation for key names that commonly show up.
I see them: https://github.com/pwr-Solaar/Solaar/pull/1222

Resolving patch:
diff --git a/lib/logitech_receiver/i18n.py b/lib/logitech_receiver/i18n.py
--- a/lib/logitech_receiver/i18n.py
+++ b/lib/logitech_receiver/i18n.py
@@ -68,4 +68,24 @@
     _('Bootloader'),
     _('Hardware'),
     _('Other'),
+
+    # common button and task names (from special_keys.py)
+    _('Left Button'),
+    _('Right Button'),
+    _('Middle Button'),
+    _('Back Button'),
+    _('Forward Button'),
+    _('Mouse Gesture Button'),
+    _('Smart Shift'),
+    _('DPI Switch'),
+    _('Left Tilt'),
+    _('Right Tilt'),
+    _('Left Click'),
+    _('Right Click'),
+    _('Mouse Middle Button'),
+    _('Mouse Back Button'),
+    _('Mouse Forward Button'),
+    _('Gesture Button Navigation'),
+    _('Mouse Scroll Left Button'),
+    _('Mouse Scroll Right Button'),
 )
diff --git a/lib/solaar/ui/config_panel.py b/lib/solaar/ui/config_panel.py
--- a/lib/solaar/ui/config_panel.py
+++ b/lib/solaar/ui/config_panel.py
@@ -105,7 +105,7 @@ def _combo_notify(cbbox, s):
     c = Gtk.ComboBoxText()
     # TODO i18n text entries
     for entry in setting.choices:
-        c.append(str(int(entry)), str(entry))
+        c.append(str(int(entry)), _(str(entry)))
     c.connect('changed', _combo_notify, setting)
     return c
 
@@ -133,7 +133,7 @@ def _map_populate_value_box(valueBox, setting, key_choice):
         if choices:
             # TODO i18n text entries
             for choice in choices:
-                valueBox.append(str(int(choice)), str(choice))
+                valueBox.append(str(int(choice)), _(str(choice)))
             if current is not None:
                 valueBox.set_active_id(str(int(current)))
 
@@ -144,7 +144,7 @@ def _map_populate_value_box(valueBox, setting, key_choice):
     c.pack_end(valueBox, False, False, 0)
     # TODO i18n text entries
     for entry in setting.choices:
-        keyBox.append(str(int(entry)), str(entry))
+        keyBox.append(str(int(entry)), _(str(entry)))
     keyBox.set_active(0)
     keyBox.connect('changed', _map_value_notify_key, (setting, valueBox))
     _map_populate_value_box(valueBox, setting, int(keyBox.get_active_id()))


Test patch: