Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few thoughts, but nothing blocking. Nice investigation!
if (immutableTranslations) { | ||
copyAndDispatchTranslations(dispatch, translations, sourceFunction(locale), locale); | ||
} | ||
}; | ||
} | ||
|
||
export function unregisterPluginTranslationsSource(pluginId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to dispatch an event on unregistration too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. We unregister translations on plugin removal, that event is dispatched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i think we should no? otherwise the plugin translation will remain in memory if i'm not mistaken.
@@ -30,6 +31,16 @@ const pluginTranslationSources = {}; | |||
|
|||
export function registerPluginTranslationsSource(pluginId, sourceFunction) { | |||
pluginTranslationSources[pluginId] = sourceFunction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely out of scope for this PR, but I'm wondering if this mapping should just live in Redux directly, and copyAndDispatchTranslations
gets moved into a reducer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
translations, | ||
}, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing newline here, suggest configuring http://editorconfig.com/
@iomodo
|
@iomodo @lieut-data @crspeller looks like this one needs some help with its cherry-picking? |
I've manually cherry picked this to v5.15. |
translations, | ||
}, | ||
}); | ||
copyAndDispatchTranslations(dispatch, translations, en, locale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely works, however it would've been nice if we had converted this into async/await
and had just one dispatch in this function rather than dispatching twice as per two different code paths.
...
set variables for 'en'
or set variables when fetching through 'Client4'
...
copyAndDispatchTranslations(dispatch, translations, serverTranslations, locale);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ali-farooq0, is this something we might yet still be able to squeeze in v5.15? Or is it an internal detail that we can safely improve in v5.16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lieut-data nah, just an internal detail that we can improve for 5.16. No need to rush it for 5.15.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://mattermost.atlassian.net/browse/MM-18239 to keep track
Test server destroyed |
* Fix plugin translations * "Unregister plugin translations when plugin is removed" * Fix lint
* Fix plugin translations * "Unregister plugin translations when plugin is removed" * Fix lint
Summary
This PR will fix plugin translations issues (translation files were not updating on the web-client when plugins were upgraded)
Ticket Link
MM-17494