2

I am working on localization if an app in android studio. While using xliff in the below code, I see the "%s" display in my screen.

<string name="name">Name <xliff:g id="get_name" example="Diana">%s</xliff:g></string>

I know that the %s is supposed to display any text that is input by the user.

Below is my activity.xml code:

<EditText
            android:id="@+id/name_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/name"
            android:inputType="textCapWords"
            android:paddingBottom="8dp"/>

In the output, I want the hint to be shown as Name but it shows as Name %s. is this a normal behavior? Is there anything that I am doing wrong here?

Kiran Cyrus Ken
  • 379
  • 1
  • 3
  • 17

1 Answers1

0

It's not completely clear, what you want to achieve by using xliff in EditText.

As far as I understand for your concrete task of localization I beleive you don't need to use xliff in your string. If you're on Windows just create an additional folder in ...\AndroidStudioProjects\YourApp\app\src\main\res

For example if you want to add spanish language create values-es folder and add there another strings.xml, where all text is in spanish, like:

<string name="name">Nombre</string>

When a user downloads your app from Google Play, his device will automatically switch language to the one, that is chosen in Android OS.

Dmitriy Fialkovskiy
  • 3,065
  • 8
  • 32
  • 47