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

how to translate trackingobject provider #340

Closed
medarob opened this issue Dec 12, 2024 · 4 comments · Fixed by #341
Closed

how to translate trackingobject provider #340

medarob opened this issue Dec 12, 2024 · 4 comments · Fixed by #341

Comments

@medarob
Copy link
Contributor

medarob commented Dec 12, 2024

I wanted to translate the trackingobject provider name in another language but nothing has worked so far.

plugin.tx_cookieman {
    settings {
        trackingObjects {
            CookieConsent {
                show {
                    MyTitle {
                        duration = 30
                        durationUnit = days
                        type = cookie_http+html
                        provider = Website
                    }
                }
            }
        }
    }
    _LOCAL_LANG {
        fr {
            trackingobject.MyTitle.provider = Site web
        }
}

The code shows:

<f:if condition="{trackingItem.provider}">
    {f:translate(
    key: trackingItem.provider,
    default: trackingItem.provider
    )}
</f:if>

But also adding trackingItem.provider as a key to an xlf file to override the string didn't work.

Should one of those methodes work or am I doing something wrong?

@jonaseberle
Copy link
Member

Hmm, I've never used that :) Looking at https://github.com/dmind-gmbh/extension-cookieman/blob/master/Resources/Private/Partials/TableRowsByGroup.html#L37 it is also inconsistent – it would have been better to use

{f:translate(
  key: provider.{trackingItem.provider},
  default: 'missing translation: provider.{trackingItem.provider}
)}

Would you like to make a PR for that?

For the current templates, it should be

_LOCAL_LANG {
        fr {
            Website = Site web
        }
}

@medarob
Copy link
Contributor Author

medarob commented Dec 13, 2024

Thank you for the answer. I can add a PR with that change.

I just also noticed the following inconsistency:

The default value for desc also is different.

current:
default: 'missing translation: trackingobject.{trackingItemId}.desc'

others:
default: 'missing translation: duration.{trackingItem.durationUnit}'
default: 'missing translation: type.{trackingItem.type}'

Should it be:
default: 'missing translation: desc.{trackingItem.desc}'

?

@jonaseberle
Copy link
Member

Hmm, I think that is ok.

You want to translate
trackingobject.{trackingItemId} and trackingobject.{trackingItemId}.desc
for the tracking object, but you don't want to translate the others (including your case "Website") for each trackingItem separately.

But let's use

{f:translate(
  key: provider.{trackingItem.provider},
  default: trackingItem.provider
)}

in the default templates.
– that way it is not breaking and users will see their current value, but they can provide a translation.

@medarob
Copy link
Contributor Author

medarob commented Dec 13, 2024

ok, created a pull request with the change
#341

@jonaseberle jonaseberle linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants