couple questions about example
See original GitHub issueHi thanks for this package looks great just have a couple questions about the examples:
a, I know I should just try it but am I right that these android paths mean the SyncExample will not run when deployed on iOS?
const translationGetters = {
// lazy requires (metro bundler does not support symlinks)
ar: () => require("../android/app/src/main/assets/translations/ar.json"),
en: () => require("../android/app/src/main/assets/translations/en.json"),
fr: () => require("../android/app/src/main/assets/translations/fr.json"),
};
Or maybe I’m misunderstanding something? e.g. Why are these android paths used here considering you’re using require is there a reason these json files don’t just live under the src directory with the rest of the javascript?
(maybe it’s an attempt to keep the translation files out of the bundle to keep them smaller is that it?)
b. Likewise in the SyncExample I notice you memoize the results of i18n.t here:
const translate = memoize(
(key, config) => i18n.t(key, config),
(key, config) => (config ? key + JSON.stringify(config) : key),
);
This time I was just curious if you did this because you saw performance issues if you didn’t? i.e. Are you doing this in your example because you recommend doing this in a real app? (I was imagining i18n.t should be fast or otherwise maybe do it’s own memoization without me needing to?)
Thanks,
Darren
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
@zoontek Can you add this information somewhere in the docs or README?
Or maybe add comments in the file itself can be of help.
I had to go through all the closed issues to find the answers. I think it will be helpful for others who are trying to find answers about the example projects.
Let me know what you think.
Thanks.
@compojoom Because I coudn’t load file on android if they are not in this directory (same happen for fonts with react-native-vector-icons) and metro does not support symlinks.