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

Option 'arguments' for translations #160

Open
KPeschke opened this issue Aug 19, 2024 · 2 comments
Open

Option 'arguments' for translations #160

KPeschke opened this issue Aug 19, 2024 · 2 comments

Comments

@KPeschke
Copy link

I'm missing the option to pass arguments for the translations (component parameter 'labels') of the Translate view helper <f:translate>.

Can you please add this to the translations?
Thank you very much!

@KPeschke
Copy link
Author

Oh, I have found a workaround. It is not necessary to adapt your code, but a note in the documentation would be great.

e.g. in your *.labels.xlf

<trans-unit id="your_label_name" xml:space="preserve">
  <source><![CDATA[%s item(s)]]></source>
  <target><![CDATA[%s Item(s)]]></target>
</trans-unit>

in your component

<fc:param optional="1" name="labels" type="Labels"/>

<f:variable name="your_label_name"><f:spaceless>
    <f:replace value="{labels.your_label_name}" search="%s" replace="{itemCount}"/>
</f:spaceless></f:variable>

@s2b
Copy link
Collaborator

s2b commented Oct 20, 2024

Btw. there is also a format.printf ViewHelper you can use: https://docs.typo3.org/other/typo3/view-helper-reference/main/en-us/Global/Format/Printf.html

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