dachcom-digital / pimcore-i18n Goto Github PK
View Code? Open in Web Editor NEWPimcore - i18n Manager
License: Other
Pimcore - i18n Manager
License: Other
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | yes |
I have a client which uses akamai cdn, which breaks getting the users ip. Akamai is using a different header 'True-Client-IP'.
It seems that the complex language switcher breaks the xliff and word export functionality.
If i remove the code everything works as expected.
Is this a bug or do I have a wrong configuration?
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Use i18n.translations as fallback for i18n.zones.zonexy.config.translations in i18n.yaml
Mostly the translations should be the same in all zones. Therefore a fallback would be useful to avoid redundancies.
Use case: Link to localized document in the current language. For example if you had documents /de/impressum
and /en/imprint
and want to link to the correct page from the start page /de
or /en
. /de/impressum
and /en/imprint
are linked with the Localization Tool
Currently there is the i18n_context
twig helper but this can only fetch linked variants of current document (or am I missing something?).
Perhaps we could either add an option to call i18n_context
with another document than the current one.
Or even better would be if we introduced a twig helper which you can provide a document object (or its full path) and a locale - and you automatically get the URL for the document in the desired language (based on linked languages of the given document).
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Steps to reproduce:
If main key element like /en_US
is disabled, it's not possible to edit sub documents in backend. We need to check if it's a request by admin.
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
I18n is ignoring a user locale without country code (de), when the same locale ist set in Pimcore with country code (de_CH).
Example 1:
User locales: de_CH, en
Pimcore locales: de, en
Current and expected Behavior: i18n redirects to de (working with PR #63)
Example 2:
User locales: de, en
Pimcore locales: de_CH, en
Current behavior: i18n redirects to en (ignoring de_CH)
Expected behavior: Redirect to de_CH because user preferred language should have more priority.
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Pimcore Translator has a wrong locale in static routes when country context is missing in language attribute.
Eg. Document locale: de_CH, static route: www.project.ch/de/my-static-route/object-xy
Fix in project:
<?php
namespace App\EventListener;
use I18nBundle\Helper\RequestValidatorHelper;
use I18nBundle\Resolver\PimcoreDocumentResolverInterface;
use Pimcore\Model\Document;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
class StaticRouteLocaleListener implements EventSubscriberInterface
{
protected PimcoreDocumentResolverInterface $pimcoreDocumentResolver;
protected RequestValidatorHelper $requestValidatorHelper;
public function __construct(
PimcoreDocumentResolverInterface $pimcoreDocumentResolver,
RequestValidatorHelper $requestValidatorHelper)
{
$this->pimcoreDocumentResolver = $pimcoreDocumentResolver;
$this->requestValidatorHelper = $requestValidatorHelper;
}
public static function getSubscribedEvents(): array
{
return [
KernelEvents::REQUEST => [
['onKernelRequestLocale', 17], // before symfony LocaleListener
]
];
}
public function onKernelRequestLocale(RequestEvent $event)
{
if ($event->isMainRequest() === false) {
return;
}
$request = $event->getRequest();
$document = $this->pimcoreDocumentResolver->getDocument($request);
if (!$document instanceof Document) {
return;
}
if (!$this->requestValidatorHelper->isValidForRedirect($request)) {
return;
}
$documentLocale = $document->getProperty('language');
$requestSource = $request->attributes->get('pimcore_request_source');
if ($requestSource === 'staticroute' && !empty($documentLocale) && $request->attributes->get('_locale') !== $documentLocale) {
$request->attributes->set('_locale', $documentLocale);
}
}
}
Q | A |
---|---|
Bug report? | no |
Feature request? | no |
BC Break report? | no |
RFC? | no |
In the following case, how would you define a dynamic path
prefix instead of matching_route_key
? Would it even be possible?
/**
* @Route("{path}/{title}~pr{object}", name="project-detail", defaults={"path"=""}, requirements={"path"=".*?", "title"="[\w-]+", "object"="\d+"})
* @Template()
*
* @param Request $request
*
* @return array
*/
public function detailAction(Request $request)
In Pimcore projects we often have a setup similar like this, just like in the pimcore demo:
de
points at the root document (id 1) wich will make it the main page for the default languageIf we install the bundle in such a projects we run into errors like this. The language is setup properly and defintion of zones are not possible, since we use no sites.
I've read all the documentation but either I don't understand it or I'm lacking some other important part.
The goal in this setup also is to strip the locale fragment of the url in the default language (domain.com/de/seite1 should be domain.com/seite1).
It seems that this could be possible with i18n:
pimcore-i18n/docs/91_StaticRoutes.md
Lines 143 to 148 in 659498a
But at another point we have the following conflicting convention in the docs:
pimcore-i18n/docs/26_Languages.md
Line 11 in 659498a
Can you please confirm if such setup is possible with i18n or not?
Thanks in advance! 😊
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
I defined a link generator to view the object preview in the Pimcore admin.
The object preview works fine without the i18n bundle but doesn't with it.
That's what I expected:
[302] http://localhost/admin/object/preview?id=4525&time=1632231904801
[200] http://localhost/en/product/funky-pj4525?pimcore_object_preview=4525&_dc=1632231904
That's what I get:
[302] http://localhost/admin/object/preview?id=4525&time=1632231904801
[302] http://localhost/en/product/funky-pj4525?pimcore_object_preview=4525&_dc=1632231904
[200] http://localhost/en/product/funky-pj4525
In this scenario, Pimcore shows an object preview from the database instead of from the session. I suppose that the i18n ignores the pimcore_object_preview
parameter.
I'll investigate, I promise!
My i18n_dev.yml
i18n:
mode: country
locale_adapter: system
default_locale: 'en'
translations: ~
zones:
zone1:
id: 1
domains:
- docker
- it
- error
- en
- error
config:
mode: country
default_locale: 'en'
locale_adapter: system
translations: ~
The alternate link generator should check against an available link generator before firing the i18n.path.static_route.alternate
event.
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Hey there! 👋
Currently the i18n_redirect
cookie is stored without secure
flag, but with HttpOnly using the Symfony Cookie class. Would it be possible to make this configurable so setting the SameSite
flag and the secure
flag by a config value?
If so, would you be ok with accepting a PR that adds this functionality? I'd create 2 PRs then, one for 3.x and one for 4.x.
Thank you very much!
Best wishes
Tom
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | yes |
RFC? | no |
I18nContext is missing in static routes if fallback document is an instance of Document\Link
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Same as in LinkPathListener, the FrontendPathListener should apply only if the current context is in hardlink context.
Q | A |
---|---|
Bug report? | no |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Q | A |
---|---|
Bug report? | yno |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Domain: mydomain.com
Document Tree:
my-old-collection-domain
mydomain.com/de/kollektion
if user is germanmydomain.com/en/collection
if user is englishmydomain.com/landingpage
mydomain.com/de/landingpage
if user is germanmydomain.com/en/landingpage
if user is english{i18n_localized_target_page=4}
as placeholder target row.Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | yes |
RFC? | yes |
Let's assume the following example scenario
country
de-DE
, de-CH
de-CH
HTTP_ACCEPT_LANGUAGE
is en
Current I18n decision
Decision is invalid because no language matches.
No country detection because of the return
in this block: https://github.com/dachcom-digital/pimcore-i18n/blame/820030747632599eb2cde06ceea7d3d8d96575a8/src/I18nBundle/Adapter/Redirector/GeoRedirector.php#L29
I18n redirects to de-CH
(Default language fallback)
Possible better decision
I18n redirects to de-DE
because the countries match
i18n:
# set mode (~|language|country)
mode: country
# define a country adapter (flat|coreshop|custom)
country_adapter: i18n.country.adapter.flat
# static route translations
translations:
- url-news:
de: 'news'
en: 'neuigkeiten'
it: 'notizia'
fr: 'nouveaute'
# zones are optional
# if no zones are defined the global configuration applies to all pages
zones:
# example 1: complex country / language i81n
- id: 1
name: 'zone 1'
# domains must be the main domain of page
domains: ['your-page.eu', 'your-page.cz', 'your-page.de', 'your-page.pl']
config:
mode: country
country_adapter: i18n.country.adapter.coreshop
translations: ~
# example 2: only language based i18n
- id: 2
name: 'zone 2'
domains: ['special-page.com', 'other-domain.jp']
config:
mode: language
country_adapter: ~
translations: ~
# example 3: No i18n since the webpage is just a simple page
- id: 3
name: 'zone 3'
domains: ['boring-page.com']
config:
mode: ~
country_adapter: ~
translations: ~
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
I18nEvents::CONTEXT_SWITCH
eventIn documents, we're able to add meta elements like this:
<meta name="robots" content="nofollow" />
Should we implement a setting node to define no follow tags to static routes or even symfony routes?
i18n:
meta:
nofollow:
- 'static_route_name'
- 'symfony_route_name'
While exporting XLIFF got this error prompts
{"success":false,"message":"An exception has been thrown during the rendering of a template (\u0022context is not defined\u0022)."}
Timestamp: Tue Mar 26 2019 10:13:58 GMT+0100 (Mitteleuropäische Normalzeit)
Status: 500 | Internal Server Error
URL: /admin/translation/xliff-export
Method: POST
Message: An exception has been thrown during the rendering of a template ("context is not defined").
PLZ fix it as discussed solverat
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Is this something planned or even possible at all? Would be awesome to have nice looking locales for Symfony Routes as well. :)
Q | A |
---|---|
Bug report? | yes |
In Pimcore v5, I want to use the full page cache but I need a PHPSESSID cookie. This disables the cache with a message
“X-Pimcore-Output-Cache-Disable-Reason: Session in use”. (Repsonse Header)
If the i18n manager bundle is disables, the cache works properly and no "PHPSESSID" is available.
Is there a possibility to run the cache with this cookie?
language_adapter
and country_adapter
context, introduce locale_adapter
default_language
and default_country
setting, introduce default_locale
Implement redirector_adapter
which allows to define redirect decisions in a more granular way.
Redirector can be enabled (default) or disabled.
i18n
registry:
redirector:
cookie:
enabled: false
default_locale
setting (per zone) or default locale defined in pimcore settings.Currently zones are configured as simple arrays:
zones:
-
id: 1
name: 'zone 1'
domains:
-
id: 2
name: 'zone 2'
domains:
when using multiple environments the subconfig gets append instead of merged. Change it to key values:
zones:
zone1:
id: 1
name: 'zone 1'
domains:
zone2:
id: 2
name: 'zone 2'
domains:
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
coreshop 2.2.2, with pimcore 6.6.7
When defining a product-price-rule in admin, (coreshop | price rules | product price rules) no decimals are possible as value. Trying to define 13,51% as discount for products in Action (Discount Percent).
Entered 13,51. After saving/leaving focus of field - it is rounded and written to 14. When entering 13,4 it is rounded to 13
Trying to enter with dot '.' is not possible.
Should be possible to enter value 13,51 without being rounded
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Site is missing by generating alternate links in AlternateDynamicRouteEvent
Exception: No zone site for locale "de_DE" found. Available zone (Id 1) site locales:
Example code to fix the issue (without regards to performance):
I18nBundle\Adapter\PathGenerator\DynamicRoute::buildAlternateRoutesStack()
Q | A |
---|---|
Bug report? | ? |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Hey,
not really sure if this is a bug or a wrong configuration, but i search de documentation and didn't really find a solution.
I got multiple domains, configured as sites in Pimcore.
Hreflangs for the homepages are ok:
But for subpages the "main domain" is always added:
And i have no idea why.
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
If php geoip extension is available, use it instead of 3rd party geoip database: https://www.php.net/manual/de/ref.geoip.php
In Backend i18n throws a document xy does not have a valid language property!
if no valid language property has been found. Redirect documents (like site documents) are not allowed to have a language property otherwise the redirect to the locale context won't work. So instead of an exception we should display a proper message:
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Allow yaml parameters for i18n.translations and i18n.zones.zonexy.config.translations.
Example yaml config:
parameters:
i18n_translations:
- key: 'event'
values:
de: 'veranstaltung'
fr: 'evenement'
en: 'event'
i18n:
translations: '%i18n_translations%'
zones:
zonexy:
config:
translations: '%i18n_translations%'
Current Exception:
Invalid type for path "i18n.translations". Expected "array", but got "string"
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Site attribute is missing in error page.
Exception in error page: An exception has been thrown during the rendering of a template ("To generate a zone object, you need to assign a valid site if zones are configured. No site assignment found. Maybe there is a typo in your i18n.zones.domains mapping?").
Assume you have only 1 domain and a document structure like /example.org/de/123 and /example.org/en/123. As zones are currently based on domains of sites how is it possible to get a language switch which contains DE and EN? Currently I only can create zone for domain example.org and so the getActiveLanguages()
only gets the 1 language - the one which is set for /example.org site.
Q | A |
---|---|
Bug report? | yes/no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
When rendering for example the add to cart partial via {{ render(path('coreshop_cart_add')) }}
it is not working because the locale does not get adjusted on child requests. Maybe we could implement a check if it is a frontend request instead of checking if it's a master request.
First of all thank you for creating this extension! 👍
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
This is my page:
Setting:
However, on both page variants (en
and id
) the only hreflang links I get is:
<link href="https://pim.lovia.life/en/edu/preschool/in/indonesia" rel="alternate" type="" title="" hreflang="en">
hreflang="id"
is never showing, neither is x-default
.
(seems like the id
document knows about the en
one, but the en
one is not aware that id
exists?)
Pimcore v6.2.0. I18nBundle 3.1.1.
I have a site document with the domain www.staging.example.org
and the following configuration in my app/config/config.yml
:
i18n:
zones:
zone_xyz:
id: 1
# domains must be the main domain of page
domains:
- "www.staging.example.org"
config:
mode: language
locale_adapter: system
translations: ~
(Actually I have some more zones for the other site documents but I think this does not matter here)
The site document www.staging.example.org
has no set language. Below this document there are documents en
and de
with the correct languages set.
When I access https://www.staging.example.org in Firefox or Chrome I get redirected to https://www.staging.example.org/de (or /en depending on Accept-Language
header) but in Safari I do not get redirected but stay on https://www.staging.example.org. Can you think of a cause for that?
I updated to Pimcore 6.6.9 and i18n dev-master but still no success.
if redirect is link then redirect to target page
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
https://domain.com/my-page
de
and en
en
GET https://domain.com/my-page/en
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="x-default">
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="en">
<link href="https://domain.com/my-page/de" rel="alternate" hreflang="de">
GET https://domain.com/my-page/en?page=2
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="x-default">
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="en">
<link href="https://domain.com/my-page/de" rel="alternate" hreflang="de">
GET https://domain.com/my-page/en
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="x-default">
<link href="https://domain.com/my-page/en" rel="alternate" hreflang="en">
<link href="https://domain.com/my-page/de" rel="alternate" hreflang="de">
GET https://domain.com/my-page/en?page=2
<link rel="canonical" href="https://domain.com/my-page/en">
i18n.canonical_query_urls: true
)https://domain.com/mypage/en/page/1
)?Only if special locale url structure is given (like /en-us/xy and locale is en_US).
Q | A |
---|---|
Bug report? | yes? |
Feature request? | no |
BC Break report? | no |
RFC? | no |
It looks like the generated x-default and alternate links are pushed as weblinks when weblinks and HTTP2 are activated. I do not think this is on purpose. These two lines src/I18nBundle/EventListener/Frontend/HeadLinkListener.php#L72 and src/I18nBundle/EventListener/Frontend/HeadLinkListener.php#L76 should add 'webLink' => false to the extra param.
Would you like me to open a PR?
Hi,
Why hreflang tags are added only in country mode?
I have only 1 zone and my language strategy is maindomain.com/en maindomain.com/it etc..
in language mode.
my zone config:
i18n:
# set mode (language|country)
mode: language
# define a language adapter (system|custom)
language_adapter: i18n.adapter.language.system
# define a country adapter (system|coreshop|custom)
country_adapter: i18n.adapter.country.system
# define a global prefix (like de-global or de-int)
global_prefix: ~
# static route translations
translations: ~
zones:
# zone 1: language and country
-
id: 1
name: 'zone 1'
domains:
- 'www.marcolin.vag'
config:
mode: language
language_adapter: i18n.adapter.language.system
country_adapter: ~
global_prefix: ~
translations: ~
HeadLinkListener.php
public function onKernelRequest(GetResponseEvent $event)
{
......
if ($this->zoneManager->getCurrentZoneInfo('mode') !== 'country') {
return;
}
$document = $this->documentResolverService->getDocument($request);
$hrefLinks = $this->pathGeneratorManager->getPathGenerator()->getUrls($document);
//add x-default to main page!
$xDefaultUrl = $this->getXDefaultLink($hrefLinks);
if (!is_null($xDefaultUrl)) {
$this->headLink->appendAlternate($this->generateHrefLink($xDefaultUrl), FALSE, FALSE, ['hreflang' => 'x-default']);
}
foreach ($hrefLinks as $route) {
$this->headLink->appendAlternate($this->generateHrefLink($route['url']), FALSE, FALSE, ['hreflang' => $route['hrefLang']]);
}
}
Regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.