Repository: mozilla/pontoon

Issue:
Pretranslated Fluent string has the ID translated or modified
It happened for at least two strings.

```
remember-pw-link = Remember your password? Sign in
```

Became

```
Remember-pw-link = Ricordi la password? Accedi
```

No clue why it changed to uppercase.

On the other hand, for 

```
plan-price-interval-year =
    { $intervalCount ->
        [one] { $amount } all’anno
       *[other] { $amount } ogni { $intervalCount } anni
    }
    .title =
        { $intervalCount ->
            [one] { $amount } all’anno
           *[other] { $amount } ogni { $intervalCount } anni
        }
```

The id was translated to `piano-prezzo-intervallo-anno`(but the translation was good besides that).



Discussion:
Was the string submitted as Error, Warning or Pretranslated?

I would expect the translation to be detected as an Error and skipped (not submitted at all).
It was showing an error (I rejected one for Slovenian as well) and it was submitted as "pretranslated".

See the string getting removed from VCS after I removed it
https://github.com/mozilla/fxa-content-server-l10n/commit/c9f2ca744b7b78328fdc2c90e174741cc19c493b


OK, so the string was marked as Error in the dashboard, it had a Pretranslated (light green) Approve icon in the History panel and was committed to VCS.

The request here is to only machine-translate the part of the message that follows the ID, and make sure the ID remains unchanged.

Resolving patch:
diff --git a/pontoon/pretranslation/pretranslate.py b/pontoon/pretranslation/pretranslate.py
--- a/pontoon/pretranslation/pretranslate.py
+++ b/pontoon/pretranslation/pretranslate.py
@@ -18,6 +18,7 @@
     get_reconstructed_message,
 )
 
+UNTRANSLATABLE_KEY = "AIzaSyDX3R5Y1kxh_8lJ4OAO"
 
 serializer = FluentSerializer()
 
@@ -40,7 +41,7 @@ def get_translations(entity, locale):
     strings = []
     plural_forms = range(0, locale.nplurals or 1)
 
-    entity_string = (
+    tm_input = (
         as_simple_translation(entity.string)
         if is_single_input_ftl_string(entity.string)
         else entity.string
@@ -48,7 +49,7 @@ def get_translations(entity, locale):
 
     # Try to get matches from translation_memory
     tm_response = get_translation_memory_data(
-        text=entity_string,
+        text=tm_input,
         locale=locale,
     )
 
@@ -58,7 +59,7 @@ def get_translations(entity, locale):
         if entity.string_plural == "":
             translation = tm_response[0]["target"]
 
-            if entity.string != entity_string:
+            if entity.string != tm_input:
                 translation = serializer.serialize_entry(
                     get_reconstructed_message(entity.string, translation)
                 )
@@ -70,12 +71,23 @@ def get_translations(entity, locale):
 
     # Else fetch from google translate
     elif locale.google_translate_code:
+        gt_input = (
+            entity.string.replace(entity.key, UNTRANSLATABLE_KEY, 1)
+            if entity.resource.format == "ftl"
+            else entity.string
+        )
+
         gt_response = get_google_translate_data(
-            text=entity.string,
+            text=gt_input,
             locale=locale,
         )
 
         if gt_response["status"]:
+            if entity.string != gt_input:
+                gt_response["translation"] = gt_response["translation"].replace(
+                    UNTRANSLATABLE_KEY, entity.key
+                )
+
             if entity.string_plural == "":
                 strings = [(gt_response["translation"], None, gt_user)]
             else:


Test patch: