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

Using translation in transformation valueMap #338

Open
bh-teufels opened this issue Jul 26, 2024 · 6 comments
Open

Using translation in transformation valueMap #338

bh-teufels opened this issue Jul 26, 2024 · 6 comments

Comments

@bh-teufels
Copy link

bh-teufels commented Jul 26, 2024

is it possible to using translations in value mapping?
like:

'transformations' => [
    10 => [
        'mapping' => [
            'valueMap' => [
                  1 => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:tx_myext.season.spring',
                  2 => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:tx_myext.season.summer',
                  3 => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:tx_myext.season.autumn',
                  4 => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:tx_myext.season.winter'
            ],
            'default' => 'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:tx_myext.season.other'
        ]
    ]
],

I think this could otherwise be achieved via a userFunction is there already something for this in the extension?

@bh-teufels bh-teufels closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2024
@bh-teufels bh-teufels reopened this Jul 26, 2024
@bh-teufels bh-teufels changed the title Create translation of records with import Using translation in transformation valueMap Jul 26, 2024
@bh-teufels
Copy link
Author

I think I'm making a mistake
the language isn't known when importing, so I have to use translation when outputting

@fsuter
Copy link
Contributor

fsuter commented Jul 28, 2024

Hi. Conceptually, your idea can work. If you have a field containing a language code in the external data, you can map as many fields as you want to that field and use a value map to reference a localized string. If you don't know the language at all though, there's indeed no way to make this work.

@bh-teufels
Copy link
Author

yes i have a field with the language code.
Was my approach correct that I would have to write a user function for this or could I do it directly?

My Record:
id, title, season, langCode
1, Event in spring, 1, EN
2, Sommerfest, 2, DE
...

so EN an DE are mixed up

@fsuter
Copy link
Contributor

fsuter commented Jul 29, 2024

It's hard to answer, because I'm not entirely sure what you are trying to achieve. Looking again at the thing with the seasons, the approach of mapping values to localized labels looks a bit weird. Assuming that it is a select-type field (on the TYPO3 side), it is just a question of either using the same values as in the external data, or mapping (with the valueMap property the external values to the select values defined in TYPO3. Then - as you mentioned in your second message - the localized labels would be used in the backend and frontend.

@fsuter
Copy link
Contributor

fsuter commented Oct 7, 2024

Is this solved for you?

@bh-teufels
Copy link
Author

not quite yet, I have to think about it again.

My problem is that I have a mixture of data sets for which there are translations and those that are only available in one language

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

No branches or pull requests

2 participants