netbox-community / netbox-topology-views

A netbox plugin that draws topology views
Apache License 2.0
696 stars 61 forks source link

Topology not showing properly when using other language than english #464

Open florent4014 opened 4 months ago

florent4014 commented 4 months ago

NetBox version

v3.7.3

Topology Views version

v3.9.0

Steps to Reproduce

1.Make sure your language is set to "English" and that "ENABLE_LOCALIZATION" is set to "True" in configuration.py

2.Go in Netbox, in the "Topology" page under "Topology View" section, display your devices (at least some patch panels with front and rear ports and end devices connected to it) with "Show Cables" and "Show Logical Connections".

3.Change your language in your profile preferences to "French".

4.Return to "Topology" and select the same things as step 2.

Expected Behavior

The topology should remain the same in any languages when defined with the same filters/parameters. In my case, when using English the patch panels are displayed, and when using French they simply vanish.

Observed Behavior

The topology isn't the same depending on the language used.

Here is the topology when using English : netbox_topology-english

Here, the same topology and filters, but using French (patch panels vanished) : netbox_topology-french

dreng commented 3 months ago

Choices in model IndividualOptions are hard coded in english. This leads to link.termination_type.name won't be found in supported_termination_types in views.py, because the name value represents the translated termination type.

views.py: if link.termination_type.name in supported_termination_types:

The same applies to

views.py: if link.termination_type.name in ignore_cable_type:

dreng commented 3 months ago

Just had a closer look. We could use link.termination_type.model instead. Unfortunately we need to make changes to the model if we go this way.

I don't get why link.termination_type.name is being translated. That does not make much sense to me and I'm not sure if this is intended.

florent4014 commented 3 months ago

I also thouhgt of that kind of design. Maybe the issue could be resolved by the translator himself.

As i'm not quite a developper nor a translator i'm afraid my understanding is quite limited.