Uploaded image for project: 'Moodle app'
  1. Moodle app
  2. MOBILE-4591

Changing language leaves strings from the previous language (Object.assign)

XMLWordPrintable

    • Hide

      This issue only needs to be tested in 1 device.

      1. Put the app in a language that has a parent language (e.g. 'en_us', whose parent is 'en').
      2. Then change the language to any other language other than 'en' or 'en_us', for example the 'km' language.
      3. Then change the language to the parent language, e.g. 'en' (note, not 'en_us'). Check that all the strings are displayed in the right language (not in the language from point 2).
      Show
      This issue only needs to be tested in 1 device. Put the app in a language that has a parent language (e.g. 'en_us', whose parent is 'en'). Then change the language to any other language other than 'en' or 'en_us', for example the 'km' language. Then change the language to the parent language, e.g. 'en' (note, not 'en_us'). Check that all the strings are displayed in the right language (not in the language from point 2).
    • MOODLE_405_STABLE
    • Moodle Apps - 2024 i3.1, Moodle Apps - 2024 i3.2

      In some edge case when changing language the strings that are not translated are displayed in the previous language. (The case is when you choose on the app a language that has a parent, then any other language, and then the parent language.)

      The reason is that in the code that manages the parent languages ​ makes an Object.assign that it shouldn't, and this causes the language strings from point 2 to overwrite the parent language strings

      To reproduce:

      1. Put the app in a language that has a parent language (e.g. 'en_us', whose parent is 'en').
      2. Then change the language to any other language other than 'en' or 'en_us', for example the 'km' language.
      3. Then change the language to 'en' (note, not 'en_us'). Strings from the language in point 2 are output. If you put it in 'en_us' it comes out fine, it only happens if you select the parent language.

      The problem is caused by this line:

      const mergedData = Object.assign(parentTranslations, data);

      It seems changing it to this code fixes the problem, but we should test it properly:

      const mergedData = {
          ...parentTranslations,
          ...data,
      };

            dpalou Dani Palou
            isabelrenedo Isabel Renedo Rouco
            Pau Ferrer Pau Ferrer
            Isabel Renedo Rouco Isabel Renedo Rouco
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 minutes
                6m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.