Reputation: 1680
Hi i try to publish a plugin in the Shopware store.after review my plugin, from Shopware send to me an error.
The plugin cannot be installed. The plugin could not be installed due to the error message "Translation required for system language 2fbb5fe2e29a4d70aa5854ce7ce3e20b" The default language must be selected during installation.
I search about it and i found this document
Fallback language The installation is not always in English or German. So make sure that your extension works in other languages as well. An example: The customer has his installation in Spanish, your extension is not yet available in this language. So you should use the English translation as fallback.
I don't know how i can define default language in my plugin
UPDATE
Before than, I defined snippet file in service.yml without priority option
<service id="MyNamespace\Resources\snippet\en_GB\SnippetFile_en_GB" public="true">
<tag name="shopware.snippet.file" />
</service>
<service id="MyNamespace\Resources\snippet\de_DE\SnippetFile_de_DE" public="true">
<tag name="shopware.snippet.file"/>
</service>
Now it's
<service id="MyNamespace\Resources\snippet\en_GB\SnippetFile_en_GB" public="true">
<tag name="shopware.snippet.file" priority="100"/>
</service>
<service id="MyNamespace\Resources\snippet\de_DE\SnippetFile_de_DE" public="true">
<tag name="shopware.snippet.file" priority="100"/>
</service>
PS:I don't us of config.xml file.Is it possible that error relate to it.For example, User can select default the language in config plugin??
Upvotes: 2
Views: 1557
Reputation: 98
a better solution should be:
use Shopware\Core\Defaults;
...
'label' => [
'en-GB' => 'my english label',
'de-DE' => 'meine deutsche Beschriftung',
Defaults::LANGUAGE_SYSTEM => 'my default language label',
]
...
Best regards
Sebastian
Upvotes: 3
Reputation: 1680
In my plugin i needed to insert data required in the custom_field I useed install method. and in there i only specified 2 language, but it is wrong.
'label' => [
'en-GB' => 'custom field example',
'de-DE' => 'Beispiel für ein benutzerdefiniertes Feld',
'2fbb5fe2e29a4d70aa5854ce7ce3e20b' => 'custom field example'
]
If customer has different default language like Spanish language,he/she get an error during the installation of the plugin.
I should have defined Fallback language as below
/**
* @param InstallContext $context
*/
public function install(InstallContext $context): void
{
parent::install($context);
$customFieldSetRepository = $this->container->get('custom_field_set.repository');
$customFieldSetRepository->create([
[
'name' => 'custom_field_example',
'global' => true,
'config' => [
'label' => [
'en-GB' => 'custom field example',
'de-DE' => 'Beispiel für ein benutzerdefiniertes Feld',
'2fbb5fe2e29a4d70aa5854ce7ce3e20b' => 'custom field example
]
],
.
.
.
Upvotes: -1