"Copy Source" button modifies ICU string

Our translators noticed a problem with the “Copy Source” button in the editor. Clicking that button seems to modify ICU strings and makes them invalid.

Here’s an example: https://discourse.crowdin.com/translate/f3230e7607a36bb0a2f97fd90605a44e/718/en-de#101146

English source string:

{ groupCount, plural,
     =1 {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                  other {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {Mentioning @{group1} exceeds the notification limit of # user.}
                  other {Mentioning @{group1} exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
     =2 {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                other {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {Mentioning @{group1} and @{group2} exceeds the notification limit of # user.}
                other {Mentioning @{group1} and @{group2} exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
  other {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {Mentioning these {groupCount} groups exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                other {Mentioning these {groupCount} groups exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {Mentioning these {groupCount} groups exceeds the notification limit of # user.}
                other {Mentioning these {groupCount} groups exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
}

Clicking “Copy Source” creates a modified version of that string:

{ groupCount, plural,
     one {}=1 {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {}one {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                  other {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {}one {Mentioning @{group1} exceeds the notification limit of # user.}
                  other {Mentioning @{group1} exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
     =2 {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {}one {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                other {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {}one {Mentioning @{group1} and @{group2} exceeds the notification limit of # user.}
                other {Mentioning @{group1} and @{group2} exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
  other {
          { isAdmin, select,
            true {
              { notificationLimit, plural,
                  one {Mentioning these {groupCount} groups exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                other {Mentioning these {groupCount} groups exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
              }
            }
            false {
              { notificationLimit, plural,
                  one {Mentioning these {groupCount} groups exceeds the notification limit of # user.}
                other {Mentioning these {groupCount} groups exceeds the notification limit of # users.}
              }
            }
            other {}
          }
        }
}

That behavior is unexpected and makes it harder for translators to correctly translate ICU strings.

For your convenience, here’s a diff of the original and the copied string:

--- a/original.txt
+++ b/copy.txt
@@ -1,15 +1,15 @@
 { groupCount, plural,
-     =1 {
+     one {}=1 {
           { isAdmin, select,
             true {
               { notificationLimit, plural,
-                  one {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
+                  one {}one {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                   other {Mentioning @{group1} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
               }
             }
             false {
               { notificationLimit, plural,
-                  one {Mentioning @{group1} exceeds the notification limit of # user.}
+                  one {}one {Mentioning @{group1} exceeds the notification limit of # user.}
                   other {Mentioning @{group1} exceeds the notification limit of # users.}
               }
             }
@@ -20,13 +20,13 @@
           { isAdmin, select,
             true {
               { notificationLimit, plural,
-                  one {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
+                  one {}one {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # user.}
                 other {Mentioning @{group1} and @{group2} exceeds the <a href="{siteSettingUrl}" target="_blank">notification limit</a> of # users.}
               }
             }
             false {
               { notificationLimit, plural,
-                  one {Mentioning @{group1} and @{group2} exceeds the notification limit of # user.}
+                  one {}one {Mentioning @{group1} and @{group2} exceeds the notification limit of # user.}
                 other {Mentioning @{group1} and @{group2} exceeds the notification limit of # users.}
               }
             }
1 Like

Hi Gerard!

As we can see, in the Editor now everything seems to be good and we didn’t manage to reproduce this. Could you please record a video recording for us where after Copy source button used, you see one {}one?

The German translation was copied manually, not with the “Copy Source” button. Here’s a video that shows the same issue for French.

Hi there,

Thank you so much for recording the video! Already creating a task on the matter to our developers. Once I will have any news I will get back to you via email :blush:

Thanks,

4 Likes