According to the pie chart of truth on the logs page, my #1 offender of wu consumption is the app’s name displayed in the top left of every page.
Customers are allowed to change the name of the app, plus specify the translated names, on the settings page. These translations are stored as its own data type. When a page loads, it checks the “lang” parameter in the url and looks up the appropriate app name translation from that data type.
This seems like such a simple thing, but I can’t figure out how to display the correct translated app name without having to do a search each time. The menu is part of a reusable element so I can’t refer to a conditional state on a page. Users can’t update option sets so I can’t use those. Users can’t update app text (?) so I can’t use that feature. User’s can’t control the results of automatic google translations - so that’s out. Any ideas on how I can reduce my searching yet still allow users to set their app’s translated names?
One way to do this is save to/load from session or local storage using a plugin like Session & Local Storage Plugin | Bubble.
Build some logic to keep it updated:
- Use a custom state to show the app name. On page load check whether the session or local storage key is available, if it is write it to this custom state. If not load it from the data type and update the custom state and the session or local storage.
- When a user updates the app name, also write it to the custom state and the session or local storage.
Hope this helps,
Nice. That’s a great idea.
When an admin updates the app name, I’m not quite sure how to flag the users’ browsers to update the key. Other than comparing the key value to the reference value - in which case it’s the same as doing a “search for”.
I’m going to experiment with putting a “ver” parameter in the url. The stored key will have the latest “ver” when it got written. So long as those values match, the app knows not to update the keys. When the app name changes, we can put in a trigger to update the “ver” parameter. Next time a user loads the page and the vers don’t match, it will update the keys. At least in theory.