-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing phrases after import #111
Comments
I have the same problem. I will create a PR for it and hopefully get it merged as soon as possible. |
@digitalcraftlabs I see your PR was not approved... I created one that works for me locally. Could you please take a look? |
@caswd That's not a problem. But I can explain what this part does exactly. After creating an element, we need to map it to a similar element with the same key. This means that the key can exist in other files, which is why we don't need to add the group condition. |
@digitalcraftlabs maybe my issue is different from yours... I have a structure like:
authors.php looks like this: return [
'page_title' => 'Authors',
]; posts.php looks like this: return [
'page_title' => 'Posts',
]; When I load it into my database with translations for 'en' and 'nl' (Dutch), the
As you can see, I am missing the Dutch phrase for |
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: