Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createAssets example
public
function
write
(
TranslatorBagInterface
$translatorBag
)
: void
{
$catalogue
=
$translatorBag
->
getCatalogue
(
$this
->defaultLocale
)
;
if
(
!
$catalogue
)
{
$catalogue
=
$translatorBag
->
getCatalogues
(
)
[
0
]
;
}
foreach
(
$catalogue
->
all
(
)
as
$domain
=>
$messages
)
{
$createdIds
=
$this
->
createAssets
(
array_keys
(
$messages
)
,
$domain
)
;
if
(
$createdIds
)
{
$this
->
tagsAssets
(
$createdIds
,
$domain
)
;
}
}
foreach
(
$translatorBag
->
getCatalogues
(
)
as
$catalogue
)
{
$locale
=
$catalogue
->
getLocale
(
)
;
if
(
!\
in_array
(
$locale
,
$this
->
getLocales
(
)
)
)
{
$this
->
createLocale
(
$locale
)
;
}