You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when using the translatable package, there's no built-in way to track when each translation was last updated. This can lead to issues when the primary locale is updated but other translations are not updated immediately, due to various reasons like downtime of a machine translator, unavailability of a human translator, or simply oversight.
This can result in outdated translations being served to users, leading to potential confusion or incorrect information being presented.
Proposed Feature:
It would be beneficial to have a way to track when each translation was last updated, and to query a model to check if there are any translations that are older (i.e., not updated as recently) as a specified locale.
I propose adding two methods to the Translatable trait:
hasOlderTranslationsThan(string $locale): bool - This method would return a boolean indicating whether there are any translations that were updated less recently than the specified locale.
getOlderTranslationsThan(string $locale): array - This method would return an array of locales for which the translations are older than the specified locale.
Implementation:
This could potentially be implemented by adding an updated_at timestamp to the JSON that stores the translations. The timestamp would be updated each time a translation is updated. The proposed methods would then use these timestamps to determine which translations are outdated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently, when using the translatable package, there's no built-in way to track when each translation was last updated. This can lead to issues when the primary locale is updated but other translations are not updated immediately, due to various reasons like downtime of a machine translator, unavailability of a human translator, or simply oversight.
This can result in outdated translations being served to users, leading to potential confusion or incorrect information being presented.
Proposed Feature:
It would be beneficial to have a way to track when each translation was last updated, and to query a model to check if there are any translations that are older (i.e., not updated as recently) as a specified locale.
I propose adding two methods to the Translatable trait:
hasOlderTranslationsThan(string $locale): bool
- This method would return a boolean indicating whether there are any translations that were updated less recently than the specified locale.getOlderTranslationsThan(string $locale): array
- This method would return an array of locales for which the translations are older than the specified locale.Implementation:
This could potentially be implemented by adding an updated_at timestamp to the JSON that stores the translations. The timestamp would be updated each time a translation is updated. The proposed methods would then use these timestamps to determine which translations are outdated.
Beta Was this translation helpful? Give feedback.
All reactions