Bug: Translations Panel UI Is Not Correctly Updated Between Various Error States
Status: RESOLVED
Priority: P2
Resolution: FIXED
Created: 2023-07-26 20:47:15+00:00
Resolved: 2023-08-10 15:16:39+00:00

## Description 

There are three parts to this issue:

**(A)** When manually opening the Translations panel for an unsupported language, then opening the settings menu, the always-translate-language and never-translate-languages are correctly disabled, but their checkbox states are not updated and retain the previously displayed values.

**(B)** After visiting a site with an unsupported language and displaying the settings menu, returning to a site for which auto-translate is enabled but fails to translate will open up the wrong panel view.

**(C)** Visiting the settings menu in this view will display the wrong languages for the always-translate-language and never-translate-language menu items.

## Steps to Reproduce

> **Note:** See attached video for an example walkthrough of STR.

1) Download and install the latest Remote Settings Devtools XPI from the releases page on GitHub: https://github.com/mozilla-extensions/remote-settings-devtools/releases

2) Switch Remote Settings to a channel in which there is no Translations language model data, e.g. `Local`, to ensure that translations fail when invoked.

3) Navigate to a website for a currently supported language, e.g. https://es.wikipedia.org.

4) Open the settings menu in the Translations panel, and enable the checkbox for Always Translate for that language. 

5) Navigate to a website for a not-yet-supported language, e.g. https://ko.wikipedia.org.

6) Manually open the Translations panel from the app menu. 

7) Open the settings menu in the Translations panel.

---

**(A) Expected Results**
- `[✔]` The always-translate-language checkbox is disabled.
- `[✔]` The always-translate-language checkbox is not checked for this unsupported language.

**(A) Actual Results**
- `[✔]` The always-translate-language checkbox is disabled. 
- `[x]` The always-translate-language checkbox **is checked** for this unsupported language.

> **Note:** This defect occurs for, and should be fixed for, the never-translate-language checkbox as well. However, the subsequent steps are only triggered when always-translate-language is checked.

---

8) Navigate back to a site in the same supported language for which you previously enabled always-translate-language.

9) The Translations panel should open after failing to auto-translate.

---

**(B) Expected Results**
- `[✔]` The panel shows the default view with the failure to translate message in the current page's language.

**(B) Actual Results**
- `[x]` The panel shows the **language no supported view for the unsupported language of the previous page**.

---

10) Open the settings menu in the Translations panel.

---

**(C) Expected Results**
- `[✔]` The always-translate-language checkbox is enabled.
- `[✔]` The always-translate-language checkbox is checked.
- `[✔]` The always-translate-language checkbox displays the current, supported document language for this website.

**(C) Actual Results**
- `[✔]` The always-translate-language checkbox is enabled.
- `[✔]` The always-translate-language checkbox is checked.
- `[x]` The always-translate-language checkbox **displays the previous, unsupported document language from the previous website**.