I am using takephoto_library for selecting multiple images.
https://github.com/crazycodeboy/TakePhoto
It is working properly but as you can see in the below screenshot, the caption is in Chinese.
I found that the view control is "com.darsh.multipleimageselect.activities" and Id of this caption is in the below
actionBar.setTitle(R.string.album_view);
Is there any way to change this string to English?
Is there any way to change this string to English?
Yes, you can change all the Strings in strings.xml
https://github.com/crazycodeboy/TakePhoto/blob/master/takephoto_library/src/main/res/values/strings.xml
Change these two chinese word to english
<string name="add">确定</string>
<string name="selected">已选</string>
In English
<string name="add">confirm</string>
<string name="selected">selected</string>
Try this .
find the strings.xml(values) and strings.xml(values-en) in the library of TakePhoto .
And change the string name to the English .
In the strings.xml(values)
string name="add">确定</string>
<string name="selected">已选</string>
<string name="limit_exceeded">最多能选 %d 张</string>
And add this to the strings.xml(values-en)
string name="add">confirm</string>
<string name="selected">selected</string>
<string name="limit_exceeded">You can choose%d at most</string>
And you can change this strings.xml(values-en) and strings.xml(values)
For internationalization, android looks in different directories for the appropriate local as determined by your selection for the phone. For instance, you should see something like this:
./explorer/src/main/res/values-uk/strings.xml
./explorer/src/main/res/values-tr/strings.xml
./explorer/src/main/res/values-ru/strings.xml
./explorer/src/main/res/values-pl/strings.xml
./explorer/src/main/res/values-de/strings.xml
./explorer/src/main/res/values-ko/strings.xml
./explorer/src/main/res/values-sv/strings.xml
...
Where the translated strings are in the values-../strings as determined by the res/values/strings.xml.
In my case, res/values/strings.xml has an entry:
<string name="createnewfolder">Create new folder</string>
which is translated in values-uk/strings.xml as
<string name="createnewfolder">Нова папка</string>
You might find Localizing with Resources useful.
Related
I would like to provide my own translations for my new Android app without using the Translation Service in Google Play Console. I have already provided translations for the app descriptions but this would be for the buttons and strings in the app.
I started to upload the xml files into the Translation Service, but then decided I don't want to pay for something that I can already translate myself. What is the best way to do this?
For example, English:
<resources>
<string name="SaveSetting">Save setting</string>
<string name="ViewSettings">View settings</string>
<string name="SavedSettings">Saved settings</string>
<string name="settingHint">Enter the setting name</string>
</resources>
Portuguese:
<resources>
<string name="SaveSetting">Salvar configuração</string>
<string name="ViewSettings">Ver configurações</string>
<string name="SavedSettings">Configurações salvadas</string>
<string name="settingHint">Nome da configuração</string>
</resources>
You create multiple string files, one for each language and the phone will automatically use the one based on the OS settings
see here: https://developer.android.com/guide/topics/resources/localization
In your case you would put your default strings in the res/values/strings.xml and the Portuguese ones in a res/values-pt/strings.xml
If you are using Android Studio, you can Open the translations editor and then add the translations for your app's strings on any language.
For more details check: https://developer.android.com/studio/write/translations-editor
Try using this tree in your project with correct folders and strings.xml suffix:
MyProject/
res/
values/
strings.xml
values-b+es/
strings.xml
mipmap/
country_flag.png
mipmap-b+es+ES/
country_flag.p
"es" for Spain, "us" USA...
Take a look:
https://developer.android.com/training/basics/supporting-devices/languages
I have an app originally written in UK English, hence all of the strings in res/values/strings.xml are in UK English.
I would like to provide a "translation" to US English. For the most part US and UK English are exactly the same, so in the US translation file I only want to specify those few string changes which are affected (about 10 of 120).
I have tried creating a res/values-en-rUS/strings.xml file (this name given by Android Studio) in which I've added only those 10 strings which differ. But Android Studio gives me errors in my main strings.xml for all the remaining strings: "XXX" is not translated in "en" (English).
So, how can I efficiently provide translations to US English - ie specify only the 10 lines, without having to duplicate all the others? Duplication is always bad for code maintenance!
You can use translatable="false" settings to flag string resources that should not be translated. Something like:
<resources>
<string name="app_name" translatable="false">EasyApp</string>
<string name="action_settings">Settings</string>
<string name="easy_app">I am a Simple App!</string>
<string name="next_page">Next Page</string>
<string name="second_page_message">I am the Second Page!</string>
<string name="title_activity_second">SecondActivity</string>
</resources>
In the above sample, the app_name will not have to be translated in other locales. This way in the default strings.xml you can provide the UK version and mark with translatable="false" all the resources that you would like to maintain in US version to be the same. In res/values-en-rUS/strings.xml you will have to add only the messages that you need to maintain in US English.
Please note that if you are planning to use other locales/languages this method may not be the appropriate one, since this way you specify that the translatable="false" resources are the same for all locales.
You can check the Configure untranslatable section rows if you need more details.
In my Android app I'm using strings.xml for all texts. I have many situations where I use almost the same string,
e.g. "Name" and "Name:" - translation is the same only additional colon is difference.
Is there any other way to have these two string except creating two string items like this:
<string name="name">Name</string>
<string name="name2">Name:</string>
There is no way you can concatenate strings in the strings.xml file.
All you can do is specify the format,
<string name="name">Name</string>
<string name="string_with_colon">%s:</string>
Then pass the name programatically,
String.format(getString(R.string.string_with_colon), getString(R.string.name));
Yes, you can do so without writing any Java/Kotlin code, only XML by using this small library I created which does so at buildtime: https://github.com/LikeTheSalad/android-stem
Usage
Based on your example, you'd have to set your strings like this:
<string name="name">Name</string>
<string name="name2">${name}:</string>
And then after building your project, you'll get:
<!-- Auto generated during compilation -->
<string name="name2">Name:</string>
I am using WebView to display the String resource. Here is the code-
<string name="abc">à</string>
<string name="abcd">è</string>
When i load this in my webView it displays some garbage values. How to display this special characters in a WebView??
Check this list of special characters and how to encode in html.
<string name="abc">à</string>
<string name="abc">è</string>
If you enter these values into your values XML file using the graphical interface, the IDE will automatically format them for you.
Put symbol code in string tag:
<string name="welcome">Welcome !</string>
Output will be look like:
Welcome !
For more symbol code use below link :
http://www.degraeve.com/reference/specialcharacters.php
Enjoy...
How do I determine the language setting of an Android device. I am doing this to internationalize my app. Thanks!
You have to use different string.xml files
res/
values/
strings.xml
values-es/
strings.xml
values-fr/
strings.xml
Refer below link
Supporting Different Languages
And also Read Localization
The most common to do this is to keep a string file with the strings you want to localize in the res/values folder. You can then create additional values folders marked with resource qualifiers that will contain localized string files.
For example, if you want to translate to german, you create the res/values-de folder and put your localized string file in the folder. Android will load this folder automatically if the language is set to german. If the current system language has no values folder, it will use the default res/values folder.
There is a very simple method: right click on the strings.xml file and select Open translation editor or click on open editor.
You will see the different entries appear in the strings.xml file. By clicking on the icon representing the Earth (Add local), you can add a new language and enter the translation of the entries as desired.
When this is done, you should see a new strings.xml file appear in the tree window, accompanied by the flag of the chosen language and the extension of this language in parentheses.
You just have to compile and test the application on your emulator, by testing different language choices on it.
Create values folder for different language and put this language String.
example : values-ca and put Canada language String in this folder.
So, if user change the phone language then it is show this country language.
Thanks.
You have to use different string.xml files
res/
values/
strings.xml
values-hi/
strings.xml
<resources>
<string name="welcome">स्वागतम</string>
<string name="email">ईमेल पता</string>
<string name="password">पासवर्ड</string>
<string name="login">लॉगिन</string>
<string name="signup">खाता नहीं है? साइन अप करें</string>
values-gu/strings.xml
<resources>
<string name="welcome">પધારો </string>
<string name="email">ઈમૈલ નું નામ</string>
<string name="password">પાસવોર્ડ</string>
<string name="login">લોગીન</string>
<string name="signup">એકાઉન્ટ નથી ? સાઈન ઉપ કરો</string>
values-ja/strings.xml
<resources>
<string name="welcome">歓迎</string>
<string name="email">電子メールアドレス</string>
<string name="password">パスワード</string>
<string name="login">ログイン</string>
<string name="signup">アカウントをお持ちでない場合は?サインアップ</string>
values-ja/strings.xml
<string name="welcome">Willkommen!</string>
<string name="email">Email Addresse</string>
<string name="password">passowrd</string>
<string name="login">Login</string>
<string name="signup">müssen nicht angemeldet? Anmeldung</string>
Do you really need this to do manually? Actually in android are already built-in internationalization mechanizms - resource qualifiers.
All you need to do is add specific strings.xml for each locale.
http://developer.android.com/guide/topics/resources/localization.html