Skip to content
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

Question about Shopware6 storage and project scope #47

Open
mjosef89 opened this issue May 16, 2024 · 3 comments
Open

Question about Shopware6 storage and project scope #47

mjosef89 opened this issue May 16, 2024 · 3 comments
Assignees
Labels
In Progress On Roadmap will come with an upcoming version

Comments

@mjosef89
Copy link
Contributor

Hi there,

first of all, thanks for this nice framework and sorry for the wall of text.
I have looked at this specifically with a focus on Shopware 6 entities and have a few questions/remarks.

There are problems with null-values when using the "shopware6" format . However, these can always occur, e.g. if a product only have minimal data yet. From my point of view, this is a bug, or am I missing something?

Fatal error: Uncaught TypeError: PHPUnuhi\Bundles\Storage\Shopware6\Service\TranslationLoader::isBinary(): Argument #1 ($str) must be of type string, null given, called in /app/vendor/boxblinkracer/phpunuhi/src/Bundles/Storage/Shopware6/Service/TranslationLoader.php on line 167 and defined in /app/vendor/boxblinkracer/phpunuhi/src/Traits/BinaryTrait.php:38

I haven't tested it extensively yet, but it seems to be sufficient to convert null values to empty strings at this point.

If the "translate" command is called with the option "--source", an attempt is still made to translate missing translations of the source language itself. However, this will always fail in this case as $existingData = $set->findAnyExistingTranslation($currentID, $sourceLocale); will throw a TranslationNotFoundException.

If the source language is not skipped in the loop, if a text is missing you get an error message for each of the other languages plus additionally for the source language. I think this is unnecessary and the source language could be skipped in this case.

My intended use is mainly related to the translation of missing texts from Shopware entities. In my opinion, however, the logic here should be able to deviate from the usual snippets.

Using the product entity as an example:
Based on the table structure, there are already fixed fields that Shopware supplies, but it may be that some of them are not needed in a project. Others could be optional and only be filled for some products.

As long as something is not available in the main language of the shop, it should not be considered "missing" in my case.

I would like the following behavior for shopware entities when the "translate" command is executed with option "--source":

If a value is missing in the "--source" language e.g. "description" skip it.
Otherwise try to translate if for all other languages where a translation is missing.

As far as I could tell after trying around a bit, this does not seem to be possible at the moment, as the processing is always independent of the source (storage) and this special case for Shopware entities can therefore not be implemented without further ado.

The framework could certainly be extended in this regard, but I am unsure whether its a good idea to bend the framework in this direction, so I wanted to ask whats your opinion is about this use-case.

@mjosef89
Copy link
Contributor Author

Update

  1. Has been fixed in the meantime
  2. I have created a PR with a first rough approach on how to solve this

@boxblinkracer
Copy link
Owner

thanks for this @mjosef89
i've continued in the PR

i think thats the last thing of the issue text in here right?

@boxblinkracer boxblinkracer added On Roadmap will come with an upcoming version In Progress labels May 25, 2024
@boxblinkracer boxblinkracer self-assigned this May 25, 2024
@mjosef89
Copy link
Contributor Author

mjosef89 commented May 27, 2024

i think thats the last thing of the issue text in here right?

Yes thats right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
In Progress On Roadmap will come with an upcoming version
Projects
None yet
Development

No branches or pull requests

2 participants