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
I've identified a potential issue in the ImportTranslationsCommand, specifically within the syncMissingTranslations() function. The function is designed to create a new phrase in the specified locale if it doesn't already exist, but only if it exists in the source locale. However, the current implementation may not correctly handle phrases across different translation files.
Current Implementation:
The existing code checks if a phrase with the same key exists in the specified locale, but it doesn't consider the translation group (file) the phrase belongs to. The relevant code is on line 130:
if (! $translation->phrases()->where('key', $phrase->key)->first()) {
Issue:
This approach can lead to inaccuracies where phrases from different groups might get conflated if they share the same key. This was apparent after some phrases were missing in my non-source languages when importing translation strings.
Proposed Change:
To address this issue, I suggest modifying the check to include the translation group. This ensures the uniqueness of phrases is respected not just by key but also by the group they belong to. The code would then look like this:
if (! $translation->phrases()->where('group', $phrase->group)->where('key', $phrase->key)->first()) {
Additional Note:
This adjustment should also be mirrored in the SyncPhrasesAction:52.
The text was updated successfully, but these errors were encountered:
I've identified a potential issue in the
ImportTranslationsCommand
, specifically within thesyncMissingTranslations()
function. The function is designed to create a new phrase in the specified locale if it doesn't already exist, but only if it exists in the source locale. However, the current implementation may not correctly handle phrases across different translation files.Current Implementation:
The existing code checks if a phrase with the same key exists in the specified locale, but it doesn't consider the translation group (file) the phrase belongs to. The relevant code is on line 130:
Issue:
This approach can lead to inaccuracies where phrases from different groups might get conflated if they share the same key. This was apparent after some phrases were missing in my non-source languages when importing translation strings.
Proposed Change:
To address this issue, I suggest modifying the check to include the translation group. This ensures the uniqueness of phrases is respected not just by key but also by the group they belong to. The code would then look like this:
Additional Note:
This adjustment should also be mirrored in the
SyncPhrasesAction:52
.The text was updated successfully, but these errors were encountered: