Can I use literal string for selector's content instead of a variable?

Hello, after I have made a template that bold surround what the selector selected, I realized that I must have the thing to be bolded be selectable by the selector. In other words I need to put everything in variable, then finally I can use {0: t(bold)} to bold it.

I would like an equivalent of mark down : bold this, for use inside my translation strings, which means I could type whatever inside the syntax. Otherwise the translator cannot directly edit the content and must provide the variable content separately, plus more work to name the variable.

{bold this: t(bold)} would not produce the desired result as it would instead try to find a local variable named “bold this”.

This is also my use case as well : {{itemCount:N0} items:t(bold)} so in the end I want it returns something like “5,000 items” all in color red. (N0 formats first, then use everything as literal string for the template)

Hmm this is a tricky one. I think you can solve this by using nesting.
Perform your main work in a nested LocalizedString
Something like this

A nested LocalizedString performs its Smart Formatting separately and then returns the result as the argument, this means its possible to achieve what you need.
It may also be possible to do it in a single string although I could not find a way. Ill look into it more and see if its possible.

I see, this is not ideal because any strings with nesting would need 2 terms and translators likely have difficulty pairing them and is difficult to maintain on the Language Management Service web interface.

I think as of now it is best to keep styling completely separate from localization + country-sensitive formatting. Maybe we could have Postprocessor list in the Localization Settings where we can process the string one more time?

Though, at the same time maybe this is out of scope of this package and I should use something like TMPro.ITextPreprocessor instead to parse my markdown-like artifacts that is remaining after passing through localization package.

1 Like

Yeah it is probably a good idea to just focus on the core string and add formatting later in a TMP preprocessor.
A Postprocessor in the localization system may work in the future. Ill keep it in mind.

1 Like