Repository: lutris/lutris

Issue:
New  Runner Versions Dialog does not always populate fully
### Bug description

The new versions dialog takes an exception when populating when a runner version has just 1 game. It appears that the % operator does not like it if there's no placeholder thing in the text.

The log did not seem to get it, but I saw this traceback on the console:

Traceback (most recent call last):
  File "/home/danj/Projects/lutris/lutris/gui/dialogs/runner_install.py", line 123, in runner_fetch_cb
    self.populate_listboxrows(self.runner_store)
  File "/home/danj/Projects/lutris/lutris/gui/dialogs/runner_install.py", line 157, in populate_listboxrows
    usage_button_text = gettext.ngettext(
TypeError: not all arguments converted during string formatting

### How to Reproduce

You'll need to a have a version of WINE that has exactly one game assigned to it.

Once you do, click the 'Manage Versions' button next to the Wine header on the sidebar. The dialog will stop populated at the first version that has just one game exactly.

### Expected behavior

The dialog should not turn its nose up at singletons like this; it should populate in full.

### Log output

```shell
2022-03-08 17:08:12,137: Starting Lutris 0.5.10
2022-03-08 17:08:12,155: No folder at /home/danj/.local/share/lutris/runners/retroarch/
2022-03-08 17:08:12,172: Using NVIDIA drivers 510.54 for x86_64
2022-03-08 17:08:12,173: GPU: Unknown
2022-03-08 17:08:12,173: GPU: 10DE:2503 196E:1377 (nvidia drivers)
2022-03-08 17:08:12,212: Startup complete
2022-03-08 17:08:38,400: Shutting down Lutris
```


### System Information

```shell
[System]
OS:              Pop!_OS 21.10 impish
Arch:            x86_64
Kernel:          5.16.11-76051611-generic
Desktop:         GNOME
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 7 5800X 8-Core Processor
Physical cores:  8
Logical cores:   16

[Memory]
RAM:             31.4 GB
Swap:            0.0 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce RTX 3060/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 510.54
OpenGL Core:     4.6.0 NVIDIA 510.54
OpenGL ES:       OpenGL ES 3.2 NVIDIA 510.54
Vulkan:          Supported
```


### Media (optional)

![Screenshot from 2022-03-08 17-08-27](https://user-images.githubusercontent.com/6507403/157334612-cfcce8b7-17c7-4bd2-b5f1-196f9e494265.png)

I have many more WINE versions than this installed!

### Checklist:

- [X] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/gui/dialogs/runner_install.py b/lutris/gui/dialogs/runner_install.py
--- a/lutris/gui/dialogs/runner_install.py
+++ b/lutris/gui/dialogs/runner_install.py
@@ -152,10 +152,10 @@ def populate_listboxrows(self, store):
 
             if runner[self.COL_INSTALLED]:
                 # Check if there are apps installed, if so, show the view apps button
-                app_count = runner[self.COL_USAGE]
+                app_count = runner[self.COL_USAGE] or 0
                 if app_count > 0:
                     usage_button_text = gettext.ngettext(
-                        "_View game",
+                        "_View %d game",
                         "_View %d games",
                         app_count
                     ) % app_count


Test patch: