fix: resolve {{count}} interpolation and add notification bell for parapharmacy products
Run Tests on Branches / Detect Changes (push) Successful in 12s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Successful in 1m44s
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m51s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
Run Tests on Branches / Detect Changes (push) Successful in 12s
Run Tests on Branches / Backend Tests (push) Has been skipped
Run Tests on Branches / Frontend Tests (push) Successful in 1m44s
Run Tests on Branches / Frontend Mobile Tests (push) Successful in 1m51s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Has been skipped
- Add interpolation support to t() function in LanguageContext (web + mobile) - Pass medicine, currentUser, onLoginRequest props to PharmacyList in ProductView - Remove duplicate title in ProductView (PharmacyList already renders one)
This commit is contained in:
@@ -36,8 +36,14 @@ export function LanguageProvider({ children }) {
|
||||
AsyncStorage.setItem(STORAGE_KEY, newLang).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const t = useCallback((key) => {
|
||||
return locales[lang]?.[key] || locales.es[key] || key;
|
||||
const t = useCallback((key, params) => {
|
||||
let str = locales[lang]?.[key] || locales.es[key] || key;
|
||||
if (params && typeof str === 'string') {
|
||||
Object.keys(params).forEach((k) => {
|
||||
str = str.replace(new RegExp(`\\{\\{${k}\\}\\}`, 'g'), params[k]);
|
||||
});
|
||||
}
|
||||
return str;
|
||||
}, [lang]);
|
||||
|
||||
const value = useMemo(() => ({ lang, setLang, t, ready }), [lang, setLang, t, ready]);
|
||||
|
||||
Reference in New Issue
Block a user