Description
Describe the bug
Hey Filestack team,
We've received several requests to support languages outside your current list ([ca, da, de, en, es, fr, he, it, ja, ko, nl, no, pl, pt, sv, ru, vi, zh, tr]
). When we pass a language that isn’t supported (for example, Lithuanian), the file picker returns an "invalid parameter" error (as expected / reasonable). We discovered that the customText
prop can be used to customize text for a supported language. We attempted to “hijack” the English translation—swapping it out for Lithuanian when needed, then reverting back by providing two different customText
objects. However, this workaround requires us to always supply custom text for both English and Lithuanian, since the customText
setting persists and cannot be unset even if removed from the options object or pass undefined or an empty object.
To Reproduce
- Use the file picker with its default settings.
- Set the language parameter to a non-supported language (e.g., Lithuanian).
- Alternatively, attempt to override the translation by passing a
customText
prop to swap English for Lithuanian. - Observe that:
- Passing an unsupported language directly results in an invalid parameter error. (As expected)
- Removing or unsetting
customText
does not refresh or revert the text, forcing you to provide acustomText
for English as well.
Expected behavior
We would expect Filestack to either:
- Allow the addition of unsupported languages via a custom text override 🙏🙏🙏, or
- Provide a mechanism (such as an unset function) to refresh or remove the persisted
customText
so that the language can be correctly switched back.
This enhancement would enable us to dynamically support additional languages without resorting to a hacky workaround. 😁
Versions:
- Filestack Version: [3.38.5]
- Browser: [Chrome]
Additional context
To give more context, our implementation involves updating the filepicker options as follows:
// If the normalized language is not supported, default to English.
if (!has(FILESTACK_SUPPORTED_LANGUAGES, updatedOptions.lang)) {
updatedOptions.lang = FILESTACK_SUPPORTED_LANGUAGES.en;
}
// If the language is English, apply custom text based on the original language.
if (updatedOptions.lang === FILESTACK_SUPPORTED_LANGUAGES.en) {
if (normalizedOriginalLang === FILESTACK_CUSTOM_TEXT_TRANSLATIONS.lt) {
updatedOptions.customText = FILESTACK_CUSTOM_TEXT.lt;
} else if (
normalizedOriginalLang === FILESTACK_CUSTOM_TEXT_TRANSLATIONS.en
) {
updatedOptions.customText = FILESTACK_CUSTOM_TEXT.en;
}
}
return updatedOptions;
};
This setup currently forces us to provide a custom translation for English in addition to Lithuanian, even when trying to revert back. Any guidance on whether there are plans to allow extending the list of supported languages—or an option to unset the persisted customText
—would be greatly appreciated.
Thanks for your support, and looking forward to your feedback!