Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
retrieveKeyFromId example
foreach
(
$translatorBag
->
getCatalogues
(
)
as
$catalogue
)
{
$locale
=
$catalogue
->
getLocale
(
)
;
if
(
!\
in_array
(
$locale
,
$this
->
getLocales
(
)
)
)
{
$this
->
createLocale
(
$locale
)
;
}
foreach
(
$catalogue
->
all
(
)
as
$domain
=>
$messages
)
{
$keysIdsMap
=
[
]
;
foreach
(
$this
->
getAssetsIds
(
$domain
)
as
$id
)
{
$keysIdsMap
[
$this
->
retrieveKeyFromId
(
$id
,
$domain
)
]
=
$id
;
}
$assets
=
[
]
;
foreach
(
$keysIdsMap
as
$key
=>
$id
)
{
if
(
isset
(
$messages
[
$key
]
)
)
{
$assets
[
$id
]
=
$messages
[
$key
]
;
}
}
$this
->
translateAssets
(
$assets
,
$locale
)
;
}
}