Commit 3f8e8b16 authored by Mike Sheldon's avatar Mike Sheldon

Add translation support to libre droid, and the beginnings of a German translation

parent 5c43f0d1
......@@ -71,7 +71,31 @@ public final class R {
public static final int main=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
public static final int account_details=0x7f040007;
public static final int add_station=0x7f04000d;
public static final int app_name=0x7f040000;
public static final int banned=0x7f040015;
public static final int cant_connect=0x7f040018;
public static final int community_loved=0x7f04000c;
public static final int download_failed=0x7f040010;
public static final int downloading=0x7f040011;
public static final int finished_download=0x7f04000f;
public static final int login=0x7f040003;
public static final int login_failed=0x7f040019;
public static final int loved=0x7f040016;
public static final int loved_tracks=0x7f04000b;
public static final int no_account=0x7f040008;
public static final int no_content=0x7f040017;
public static final int not_google_account=0x7f040006;
public static final int password=0x7f040004;
public static final int playlist_failed=0x7f040014;
public static final int quit=0x7f040012;
public static final int register=0x7f040009;
public static final int sd_card_needed=0x7f04000e;
public static final int tag_examples=0x7f040001;
public static final int tag_stations=0x7f04000a;
public static final int tagged_station=0x7f040002;
public static final int tuning_in=0x7f040013;
public static final int username=0x7f040005;
}
}
......@@ -6,18 +6,18 @@
<ViewAnimator android:layout_height="fill_parent" android:id="@+id/viewAnimator" android:layout_width="fill_parent">
<ScrollView android:id="@+id/ScrollView01" android:layout_height="fill_parent" android:layout_width="fill_parent">
<TableLayout android:id="@+id/TableLayout03" android:layout_height="wrap_content" android:layout_width="fill_parent"><ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_marginTop="10px" android:src="@drawable/logo"></ImageView><TextView android:id="@+id/TextView06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Libre.fm account details:" android:textStyle="bold" android:layout_marginTop="10px" android:layout_marginBottom="0px"></TextView><TextView android:id="@+id/TextView07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="(This is not the same as your Google account)" android:layout_marginBottom="10px"></TextView><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Username:"></TextView><EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/usernameEntry" android:singleLine="true"></EditText><TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Password:" android:layout_marginTop="10px"></TextView><EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:password="true" android:id="@+id/passwordEntry" android:singleLine="true"></EditText>
<Button android:layout_width="wrap_content" android:id="@+id/loginButton" android:text="Login" android:layout_height="wrap_content" android:layout_marginTop="20px"></Button>
<TextView android:id="@+id/TextView05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Don't have an account?" android:layout_marginTop="20px" android:textStyle="bold"></TextView><TextView android:id="@+id/TextView04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="web" android:clickable="true" android:text="Visit www.libre.fm to sign up for a free account."></TextView>
<TableLayout android:id="@+id/TableLayout03" android:layout_height="wrap_content" android:layout_width="fill_parent"><ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_marginTop="10px" android:src="@drawable/logo"></ImageView><TextView android:id="@+id/TextView06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="10px" android:layout_marginBottom="0px" android:text="@string/account_details"></TextView><TextView android:id="@+id/TextView07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10px" android:text="@string/not_google_account"></TextView><TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/username"></TextView><EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/usernameEntry" android:singleLine="true"></EditText><TextView android:id="@+id/TextView03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10px" android:text="@string/password"></TextView><EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:password="true" android:id="@+id/passwordEntry" android:singleLine="true"></EditText>
<Button android:layout_width="wrap_content" android:id="@+id/loginButton" android:layout_height="wrap_content" android:layout_marginTop="20px" android:text="@string/login"></Button>
<TextView android:id="@+id/TextView05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20px" android:textStyle="bold" android:text="@string/no_account"></TextView><TextView android:id="@+id/TextView04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="web" android:clickable="true" android:text="@string/register"></TextView>
</TableLayout>
</ScrollView>
<ScrollView android:id="@+id/ScrollView02" android:layout_height="fill_parent" android:layout_width="fill_parent">
<TableLayout android:id="@+id/StationLayout" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" android:visibility="visible">
<ImageView android:id="@+id/ImageView01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_marginTop="10px" android:layout_marginBottom="10px" android:src="@drawable/tower"></ImageView>
<Button android:layout_width="wrap_content" android:id="@+id/tagStationButton" android:text="Tag Stations" android:layout_height="wrap_content"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/loveStationButton" android:text="Your Loved Tracks" android:layout_height="wrap_content"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/communityStationButton" android:text="Community's Loved Tracks" android:layout_height="wrap_content"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/tagStationButton" android:layout_height="wrap_content" android:text="@string/tag_stations"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/loveStationButton" android:layout_height="wrap_content" android:text="@string/loved_tracks"></Button>
<Button android:layout_width="wrap_content" android:id="@+id/communityStationButton" android:layout_height="wrap_content" android:text="@string/community_loved"></Button>
</TableLayout>
</ScrollView>
......@@ -27,10 +27,10 @@
<TableLayout android:id="@+id/TableLayout01" android:layout_height="wrap_content" android:layout_width="fill_parent">
<ImageView android:id="@+id/ImageView05" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_marginTop="10px" android:src="@drawable/logo"></ImageView>
<TextView android:id="@+id/TextView08" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Station tagged with:" android:textStyle="bold" android:layout_marginTop="10px" android:layout_marginBottom="0px"></TextView>
<TextView android:id="@+id/TextView08" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="10px" android:layout_marginBottom="0px" android:text="@string/tagged_station"></TextView>
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/stationEntry" android:singleLine="true"></EditText>
<TextView android:id="@+id/TextView09" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Examples: acoustic, female vocals, german, piano, violin, french, etc." android:layout_marginBottom="10px"></TextView>
<Button android:layout_width="wrap_content" android:id="@+id/addStationButton" android:text="Add Station" android:layout_height="wrap_content"></Button>
<TextView android:id="@+id/TextView09" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10px" android:text="@string/tag_examples"></TextView>
<Button android:layout_width="wrap_content" android:id="@+id/addStationButton" android:layout_height="wrap_content" android:text="@string/add_station"></Button>
</TableLayout>
<ScrollView android:id="@+id/ScrollView03" android:layout_height="fill_parent" android:layout_width="fill_parent">
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Libre Droid</string>
<string name="tag_examples">Examples: acoustic, female vocals, german, piano, violin, french, etc.</string>
<string name="tagged_station">Station tagged with:</string>
<string name="login">Anmelden</string>
<string name="password">Passwort:</string>
<string name="username">Benutzername:</string>
<string name="not_google_account">(This is not the same as your Google account)</string>
<string name="account_details">Libre.fm account details:</string>
<string name="no_account">Brauchst du ein Konto?</string>
<string name="register">Visit www.libre.fm to sign up for a free account.</string>
<string name="tag_stations">Tag Stations</string>
<string name="loved_tracks">Your Loved Tracks</string>
<string name="community_loved">Community\'s Loved Tracks</string>
<string name="add_station">Add Station</string>
<string name="sd_card_needed">Please ensure an SD card is inserted before attempting to download songs.</string>
<string name="finished_download">Finished downloading &quot;%s&quot;</string>
<string name="download_failed">Unable to download &quot;%s&quot;:</string>
<string name="downloading">Downloading &quot;%s&quot; to your SD card.</string>
<string name="quit">Quit</string>
<string name="tuning_in">Tuning in...</string>
<string name="playlist_failed">Unable to process playlist:</string>
<string name="banned">Banned</string>
<string name="loved">Loved</string>
<string name="no_content">Sorry, this station doesn\'t appear to have any more content.</string>
<string name="cant_connect">Unable to connect to libre.fm server:</string>
<string name="login_failed">Incorrect username or password</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, LibreDroid!</string>
<string name="app_name">Libre Droid</string>
<string name="tag_examples">Examples: acoustic, female vocals, german, piano, violin, french, etc.</string>
<string name="tagged_station">Station tagged with:</string>
<string name="login">Login</string>
<string name="password">Password:</string>
<string name="username">Username:</string>
<string name="not_google_account">(This is not the same as your Google account)</string>
<string name="account_details">Libre.fm account details:</string>
<string name="no_account">Don\'t have an account?</string>
<string name="register">Visit www.libre.fm to sign up for a free account.</string>
<string name="tag_stations">Tag Stations</string>
<string name="loved_tracks">Your Loved Tracks</string>
<string name="community_loved">Community\'s Loved Tracks</string>
<string name="add_station">Add Station</string>
<string name="sd_card_needed">Please ensure an SD card is inserted before attempting to download songs.</string>
<string name="finished_download">Finished downloading &quot;%s&quot;</string>
<string name="download_failed">Unable to download &quot;%s&quot;:</string>
<string name="downloading">Downloading &quot;%s&quot; to your SD card.</string>
<string name="quit">Quit</string>
<string name="tuning_in">Tuning in...</string>
<string name="playlist_failed">Unable to process playlist:</string>
<string name="banned">Banned</string>
<string name="loved">Loved</string>
<string name="no_content">Sorry, this station doesn\'t appear to have any more content.</string>
<string name="cant_connect">Unable to connect to libre.fm server:</string>
<string name="login_failed">Incorrect username or password</string>
</resources>
......@@ -26,7 +26,6 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
......@@ -223,7 +222,7 @@ public class LibreDroid extends ListActivity {
public void onListItemClick(ListView l, View v, int pos, long id) {
super.onListItemClick(l, v, pos, id);
String selection = l.getItemAtPosition(pos).toString();
if(selection.equals("Add A Custom Station...")) {
if(selection.equals(R.string.add_station)) {
LibreDroid.this.nextPage();
} else {
LibreDroid.this.libreServiceConn.service.tuneStation("globaltags", selection);
......@@ -353,8 +352,7 @@ public class LibreDroid extends ListActivity {
public void save() {
Song song = this.libreServiceConn.service.getSong();
Toast.makeText(LibreDroid.this,
"Downloading \"" + song.title + "\" to your SD card.",
Toast.makeText(LibreDroid.this, getString(R.string.downloading, song.title),
Toast.LENGTH_LONG).show();
new DownloadTrackTask().execute(song);
}
......@@ -363,7 +361,7 @@ public class LibreDroid extends ListActivity {
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem changeStation = menu.add(0, Menu.FIRST, 0, "Change Station")
.setIcon(R.drawable.back);
MenuItem quit = menu.add(0, 2, 0, "Quit").setIcon(R.drawable.quit);
MenuItem quit = menu.add(0, 2, 0, R.string.quit).setIcon(R.drawable.quit);
changeStation.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
final ViewAnimator view = (ViewAnimator) findViewById(R.id.viewAnimator);
......@@ -433,7 +431,7 @@ public class LibreDroid extends ListActivity {
if (!Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
res.add(false);
res.add("Please ensure an SD card is inserted before attempting to download songs. " + Environment.getExternalStorageState());
res.add(R.string.sd_card_needed + " " + Environment.getExternalStorageState());
return res;
}
File musicDir = new File(root, "Music");
......@@ -465,10 +463,10 @@ public class LibreDroid extends ListActivity {
bis.close();
is.close();
res.add(true);
res.add("Finished downloading \"" + song.title + "\"");
res.add(getString(R.string.finished_download, song.title));
} catch (Exception ex) {
res.add(false);
res.add("Unable to download \"" + song.title + "\": "
res.add(getString(R.string.download_failed, song.title)
+ ex.getMessage());
}
return res;
......
......@@ -2,7 +2,6 @@ package fm.libre.droid;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URI;
import java.net.URL;
......@@ -128,7 +127,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
// Login for streaming
String output = this.httpGet("http://alpha.libre.fm/radio/handshake.php?username=" + username + "&passwordmd5=" + passMD5);
if (output.trim().equals("BADAUTH")) {
Toast.makeText(this, "Incorrect username or password", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.login_failed, Toast.LENGTH_SHORT).show();
} else {
String[] result = output.split("[=\n]");
for (int x=0; x<result.length; x++) {
......@@ -149,7 +148,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
wsp.parse(output);
this.serviceToken = wsp.getKey();
} catch (Exception ex) {
Toast.makeText(this, "Unable to connect to libre.fm server: " + ex.getMessage(), Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.cant_connect + " " + ex.getMessage(), Toast.LENGTH_LONG).show();
}
return loggedIn;
}
......@@ -186,7 +185,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
if (this.currentSong >= this.playlist.size()) {
this.getPlaylist();
if(this.playlist.size() == 0) {
Toast.makeText(this, "Sorry, this station doesn't appear to have any more content.", Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.no_content, Toast.LENGTH_LONG).show();
this.stop();
return;
}
......@@ -247,7 +246,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
Song song = this.getSong();
try {
this.httpPost("http://alpha.libre.fm/2.0/", "method", "track.love", "sk", this.serviceToken, "artist", song.artist, "track", song.title);
Toast.makeText(this, "Loved", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.loved, Toast.LENGTH_SHORT).show();
} catch (Exception ex) {
Log.d("libredroid", "Couldn't love " + song.title + ": " + ex.getMessage());
}
......@@ -257,7 +256,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
Song song = this.getSong();
try {
this.httpPost("http://alpha.libre.fm/2.0/", "method", "track.ban", "sk", this.serviceToken, "artist", song.artist, "track", song.title);
Toast.makeText(this, "Banned", Toast.LENGTH_SHORT).show();
Toast.makeText(this, R.string.banned, Toast.LENGTH_SHORT).show();
} catch (Exception ex) {
Log.d("libredroid", "Couldn't ban " + song.title + ": " + ex.getMessage());
}
......@@ -288,7 +287,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
this.playlist.parse(xspf);
} catch (Exception ex) {
Log.w("libredroid", "Unable to process playlist: " + ex.getMessage());
Toast.makeText(this, "Unable to process playlist: " + ex.getMessage(), Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.playlist_failed + " " + ex.getMessage(), Toast.LENGTH_LONG).show();
}
}
......@@ -297,7 +296,7 @@ public class LibreService extends Service implements OnBufferingUpdateListener,
}
public void tuneStation(String type, String station) {
Toast.makeText(this, "Tuning in...", Toast.LENGTH_LONG).show();
Toast.makeText(this, R.string.tuning_in, Toast.LENGTH_LONG).show();
Log.d("librefm", "Tuning to librefm://" + type + "/" + station);
new TuneStationTask().execute(type, station);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment