pub(crate) fn set_translator_for_translations_str(
        &self,
        locale: &str,
        translations_str: &str,
    ) -> Result<(), ClientError> {
        if self.preflight_check(locale)? {
            let translator = match Translator::new(locale.to_string(), translations_str.to_string())
            {
                Ok(translator) => translator,
                Err(err) => {
                    return Err(FetchError::SerFailed {
                        url: "*".to_string(),
                        source: err.into(),
                        ty: AssetType::Translations,
                    }
                    .into())
                }
            };
            self.cache_translator(translator);
            // Only set `lang` if everything else worked (otherwise we'd end up with state
            // inconsistencies)
            Self::set_html_lang(locale);
        }

        Ok(())
    }
Caches a `Translator` for the given locale, using the given translations
string. This is intended to be used when fetching the translations
string from the window variable provided by the server for initial
loads.

# Panics
This will panic if the given locale is not supported.
packages/perseus/src/i18n/client_translations_manager.rs