CellularPrivacy / Android-IMSI-Catcher-Detector

AIMSICD • Fight IMSI-Catcher, StingRay and silent SMS!
https://cellularprivacy.github.io/Android-IMSI-Catcher-Detector/
GNU General Public License v3.0
4.74k stars 949 forks source link

Language Localization via GitHub #190

Closed SecUpwN closed 9 years ago

SecUpwN commented 9 years ago

Good morning everyone! Yes, another "Issue", but with the lowest priority ever seen. Why? Simply because I would like to have a place to discuss this, it has been going through my mind for a long time. This Issue is actually also meant for Android developers watching our project to chime in and raise their voice. So be brave and open your mouth, recommend us a "best practice" on how to localize our App.

Proposal of the Idea:

  1. On the initial stratup, our app shall first prompt to choose a language, then display the disclaimer.
  2. Add another button called Language into our existing Preferences for later language change

Possible Solutions:

Some services I found:

Since I feel our project to have an obligation to carry out the word about awesome Open Source software, I would like to only use free and preferably open source services for localization of our App. Which service works best? Feel invited to suggest more! Once everyone agreed, I will set it up. But then again, if @tobykurien or @Ueland could craft a pull request to restructure our App to be easily translatable via country-specic strings.xml (or any other restructuring), I'd prefer our translations to stay on GitHub.


Why localize our App?

Psychology is hard to understand, but simply by the very fact that people can read our App in their native language makes it more easy to use and more attractive to contribute to. Discussion is open, chime in!

agilob commented 9 years ago

Answering to post in different thread

  1. I think application on start should use system default language. From the listed services I used only Transifex, but as a user, not developer. From my experience, I think we wouldn't need it, this application doesn't have that much strings.

Android-studio and IDEA provide very easy to use interface for translations. For non-technical people (or devs without android-studio/IDEA) any text editor with xml syntax highlighting should be enough to work with.

translation

All strings in strings.xml are translatable, some of them shouldn't (like app_name_short app_name empty disclaimer_link wiki_link) to avoid mess and misunderstandings.

I prepared today initial Polish values-pl folder just to see how things look like:

screenshot_2015-04-16-21-06-21

SecUpwN commented 9 years ago

I think application on start should use system default language. From the listed services I used only Transifex, but as a user, not developer. From my experience, I think we wouldn't need it, this application doesn't have that much strings.

Thanks, that makes sense ans simplifies stuff a lot. So I guess we just need to add the correct transtionsto the string.xml and ensure that AIMSICD is using the current system language?

agilob commented 9 years ago

No, just create one folder app/src/main/res/values-pl/ with strings.xml per language is enough. Android will start application with system default language, so if I use Polish as my system lang, AIMSICD will be started with resource values-pl. If some strings are not translated or don't exist in values-pl, Android will fallback to strings from general values folder.

Each language has to have its own values-[code] folder. When creating new strings (XML entry) Android-studio/IDEA can create new entries in all folders, without any manual modifications. Those strings will be added to all strings.xml files with provided value.

ss1 ss2

git diff
+++ app/src/main/java/com/SecUpwN/AIMSICD/activities/BaseActivity.java
-        Log.d(TAG, "StatusWatcher starting watching");
+        Log.d(TAG, String.valueOf(R.string.status_watcher_starting_watching));
+++ app/src/main/res/values/strings.xml
@@ -261,6 +261,7 @@
+    <string name="status_watcher_starting_watching">status watcher starting watching</string>

The same entry was added to values-pl/strings.xml.

In case of this project, I also had to translate arrays.xml file and remove pref-*-values arrays, so my translated arrays.xml looks like this. That's another thing to refactor, those values should be represented as strings, not hardcoded values:

Modify in values/arrays.xml:

<string-array name="pref_refresh_entries">
    <item>@string/pref_refresh_manual</item>
    <item>@string/pref_refresh_automatic</item>

add those entries in values/strings.xml:

<string name="pref_refresh_manual">"Manual"</string>
<string name="pref_refresh_automatic">"Automatic"</string>

I can start doing initial Polish translation for this project in next weeks (doing my major project right now) and I can refactor this code.

SecUpwN commented 9 years ago

@agilob, it's awesome to see your very detailed explanation of the procedure - it makes perfect sense and enables us to avoid having to use yet another service for translations. Listen up, here's my plan: I will have finished the cleanup of our repository later today (likely in a few hours). I know you don't have much time, but you are the one with much more experience in this field, thus I am directly assigning this Issue to you. Please wait until I have sent you an email with the "permission" to fork our project again (everyone will have to re-fork after the cleanup). It would be lovely if you would craft a PR for this later:

I will add a small guide in our CONTRIBUTING.md as soon as your PR has been crafted. But again, please wait until you have received my explicit green light via email. Thanks for managing this Issue!

agilob commented 9 years ago

You can find my email address and OPGP key here

SecUpwN commented 9 years ago

Again, awesome work @agilob! Keep it comin'! :smile_cat: