How to remove unused languages with Android Studio? - android

I want to know how to remove unused languages from application with Android Studio, like French or German (unused Languages for me). I only need English and Arabic.

From Developer Documentation here
To delete a language, do the following:
You can delete a language in the Translations Editor by deleting every value in the column (see Edit, add, or delete text), or you can delete the project folder for that language, as follows:
In the Project > Android panel on the left, select ModuleName > res.
Right click the values-* folder for the language you want to delete. For example, values-hi for Hindi or strings.xml (in).
From the drop-down list, select Delete to delete the folder and its strings.xml file.

There is an easy way to do this now:
Open Translations Editor (double Shift and Open Translations Editor)
Right click the desired column and select Remove Locale

Related

How to support Spanish and French Language in android?

I want to change the application content from English to Spanish/ French as per the selection. Do we have any build-in libraries for the same. I am new to this multilanguage part, so please help me with this.
You just need to create an additional folder like values-fr (for French) and provide strings.xml with respective values.
here you can find detailed guide:
https://developer.android.com/guide/topics/resources/localization
Create strings.xml(fr) and strings.xml(es) with your translated strings in the respective language.
Use this library to set the language in your app, it manages all the overhead of Configuration Context and other boilerplate code
https://github.com/YarikSOffice/lingver.
This how you create multiple language resources
In android studio
Res-> New -> Android Resource File->
Name the file strings.xml -> Resoure Type Should be value
Select Locale From Available Qualifiers
Select Language and Set region to be any
Click Ok

Translations editor not enabled in Android Studio

I'm trying to translate a strings.xml file on Android Studio but it seems like the Translations Editor is not enabled (it does not appear as an option when I right click on the strings.xml file). I've tried deleting and installing back Android Studio but it's still the same; any ideas on how to solve?
Thank you in advance!
this is the "no enabled action found message I get
you have to open the string.xml file, then you will see the open editor option on the upper right side
Reopen the Android Studio IDE, it'll solve the problem. Also it will update the strings and refresh the layout of any layout xml.
Translations Editor shows up when you right-click on string resource files whose names end with strings.xml. On others it does not. The same goes for editor option that is supposed to show up in upper right side when string resource file is opened.
So, filenames like strings.xml, preferences_strings.xml, etc. are fine, while strings_intro.xml, etc. are not.
In case you don't have any string resource files named in that way, you can create an empty one named strings.xml and use it to open Translations Editor.
Or, you can open the it in the following way:
Open any xml layout file
Switch to 'Design' view in upper right corner
Design toolbar will look something like the following:
Click on the localizations option (globe icon)
At the bottom of the drop-down menu you will see 'Edit Translations...' option
Click on it - and there you are!

rtl for persian navigation drawer?

i have a e-ccommerce app is ltr and english languge...i want translate to persian and rtl
Add android:supportsRtl="true" to AndoridManifest.xml and then, you'll need to create another Strings.xml in order to translate the app to Persian or any languages.
Create values-fa in /res directory of your project and then, copy-paste the Strings.xml into the values-fa directory.
Then you'll be able to translate those words in Persian in order to show in the app later. However, Android Studio has Edit Translation for these situations which if you did like I mentioned, click on Open Editor:
Then translating the strings will be pretty easy.
Read: https://developer.android.com/training/basics/supporting-devices/languages

translate an android app by translation editor

I'm having trouble with translating my app. I saw that I need to go to the translation editor, however after open the translation editor I cant see the text that I need to translate and there are not any langues suggested.
I have android studio 2.2.3
Click Globe icon (above key column) and select the language you want to translate. A new column ( and strings.xml file ) will be added for the selected language. Now you can add translated text in that column or directly edit the new strings.xml
After adding new language, release builds require translation for each string. If you don't need to provide translation for some of the strings you can mark them as untranslatable in translation editor or edit strings like
<string name="demo" translatable="false">Demo</string>

Remove a string in all the languages Android

I have an app with several translations, and I want to delete some strings.
How can I refactor and delete them only once for example in the default strings.xml file and automatically propagate the deletion to the other strings.xml file of other translations?
You can remove all translations by "Translations Editor" in Android Studio.
Select string's key
Click on "Remove key" button
Uncheck all checkboxes in "Delete" dialog
Click "OK" button in "Delete" dialog
CTRL-H
select tab File Search
check regular expression
input \R\s*<string name="string_name">(.|\R)*?</string> and
don't forget replace string_name to actual string name.
file name patterns set *.xml
Press Replace...
Leave replace field empty.
Press Preview >
Check all replacement.
Apply changes by press `Ok'
default strings.xml file and automatically propagate the deletion to the other strings.xml file of other translations
ADT does not support this operation. You need to get rid of the text from all your XML files yourself, which should not be hard task anyway, as it would be sufficient to do project global search (in Eclipse CTRL-H), set file mask to *.xml and search for your string key. Then just remove this file from each file found.
Now you can do it easily with Translations Editor.
To open it click on the Open editor on the top right corner in xml file.
Then in the editor right click on key you are want to delete and press Delete Keys(s)
This is the way that I have done to Delete a language I do not want.
1: Make a backup copy of your project.zip
2:Go to Your project folder >app>src>main>res:
In this folder, you will find all languages ​​in the form of folders
Remove the language folder that you not want For example : values-ar-rSA
back to android studio clean your project and test

Categories

Resources