0

Let's say i have a info like

android:hint="Event*"

I'm trying to internationalize my app. So, I have 10 languages and in all language Event is translated So i'll put it on string resource and use it like

android:hint="@string/event"

Now, I just want to use this Event in same way sometimes and in some cases I need to append it with some special character's like * ! @ $ etc.

I don't want it to set from java file nor i like to use data binding i.e {{ }} in direct xml is there any way to concat string like

android:hint="@string/event + *"

android:hint="@string/event + !"

android:hint="@string/event + %"

if not i need to feature request android team. how to request them ?

2
  • Do it programmatically.Like youredittext.setHint(""); Commented Dec 10, 2019 at 7:28
  • @ParthLotia This is very old project and already it's done if i want to change programatically i need to mess with their code. it's complicated there are at least 1000 strings. Commented Dec 10, 2019 at 7:29

1 Answer 1

1

What you want is possible to be done statically.

But, a little search gave me this library LikeTheSalad

Extract of the README :

It allows you to do something like this:

<string name="app_name">world</string>
<string name="template_welcome_message">hello ${app_name}</string>

And then the library does this at build time:

<string name="welcome_message">hello world</string>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.