Added French translation by Kurosu + Google Translate

This commit is contained in:
pelya
2010-10-13 14:19:13 +03:00
parent 2e1a4992d3
commit 2607d74b72
4 changed files with 136 additions and 54 deletions

View File

@@ -1,4 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Alien Blaster</string>
<string name="init">Initializing</string>
<string name="please_wait">Please wait while data is being downloaded</string>
<string name="device_config">Device configuration</string>
<string name="device_change_cfg">Change device configuration</string>
<string name="download_unneeded">No need to download</string>
<string name="connecting_to">Connecting to %s</string>
<string name="failed_connecting_to">Failed connecting to %s</string>
<string name="error_connecting_to">Error connecting to %s</string>
<string name="dl_from">Downloading data from %s</string>
<string name="error_dl_from">Error downloading data from %s</string>
<string name="error_write">Error writing to %s</string>
<string name="dl_progress">%.0f%% done: file %s</string>
<string name="dl_finished">Finished</string>
<string name="storage_phone">Internal storage - %d MB free</string>
<string name="storage_sd">SD card storage - %d MB free</string>
<string name="storage_question">Where to download application data</string>
<string name="optional_downloads">Optional downloads</string>
<string name="ok">OK</string>
<string name="controls_arrows">Arrows / joystick / dpad</string>
<string name="controls_trackball">Trackball</string>
<string name="controls_accel">Accelerometer</string>
<string name="controls_touch">Touchscreen only</string>
<string name="controls_question">What kind of navigation keys does your device have?</string>
<string name="controls_additional">Additional controls to use</string>
<string name="controls_screenkb">On-screen keyboard</string>
<string name="controls_accelnav">Accelerometer as navigation keys</string>
<string name="controls_screenkb_size">On-screen keyboard size</string>
<string name="controls_screenkb_large">Large</string>
<string name="controls_screenkb_medium">Medium</string>
<string name="controls_screenkb_small">Small</string>
<string name="controls_screenkb_tiny">Tiny</string>
<string name="controls_screenkb_theme">On-screen keyboard theme</string>
<string name="controls_screenkb_by">%s by %s</string>
<string name="trackball_no_dampening">No dampening</string>
<string name="trackball_fast">Fast</string>
<string name="trackball_medium">Medium</string>
<string name="trackball_slow">Slow</string>
<string name="trackball_question">Trackball dampening</string>
<string name="accel_fast">Fast</string>
<string name="accel_medium">Medium</string>
<string name="accel_slow">Slow</string>
<string name="accel_question">Accelerometer sensitivity</string>
<string name="audiobuf_small">Small (fast devices, less lag)</string>
<string name="audiobuf_medium">Medium</string>
<string name="audiobuf_large">Large (if sound is choppy)</string>
<string name="audiobuf_question">Size of audio buffer</string>
</resources>

View File

@@ -22,6 +22,11 @@ import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import android.content.Context;
import android.content.res.Resources;
import java.lang.String;
class CountingInputStream extends BufferedInputStream {
private long bytesReadMark = 0;
@@ -113,7 +118,7 @@ class DataDownloader extends Thread
public String text;
public void run()
{
Status.setText(text + "\n" + Globals.ReadmeText);
Status.setText(text);
}
}
synchronized(DataDownloader.this) {
@@ -169,6 +174,8 @@ class DataDownloader extends Thread
String [] downloadUrls = DataDownloadUrl.split("[|]");
if( downloadUrls.length < 2 )
return false;
Resources res = Parent.getResources();
String path = getOutFilePath(DownloadFlagFileName);
InputStream checkFile = null;
@@ -193,7 +200,7 @@ class DataDownloader extends Thread
System.out.println("Matched: " + String.valueOf(matched));
if( ! matched )
throw new IOException();
Status.setText( "No need to download" );
Status.setText( res.getString(R.string.download_unneeded) );
return true;
} catch ( IOException e ) {};
}
@@ -233,7 +240,7 @@ class DataDownloader extends Thread
DoNotUnzip = true;
}
System.out.println("Connecting to " + url);
Status.setText( "Connecting to " + url);
Status.setText( res.getString(R.string.connecting_to, url) );
request = new HttpGet(url);
request.addHeader("Accept", "*/*");
try {
@@ -259,16 +266,16 @@ class DataDownloader extends Thread
if( response == null )
{
System.out.println("Error connecting to " + url);
Status.setText( "Error connecting to " + url );
Status.setText( res.getString(R.string.failed_connecting_to, url) );
return false;
}
Status.setText( "Downloading data from " + url );
Status.setText( res.getString(R.string.dl_from, url) );
totalLen = response.getEntity().getContentLength();
try {
stream = new CountingInputStream(response.getEntity().getContent());
} catch( java.io.IOException e ) {
Status.setText( "Error downloading data from " + Globals.DataDownloadUrl );
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
@@ -287,7 +294,7 @@ class DataDownloader extends Thread
} catch( SecurityException e ) { };
if( out == null )
{
Status.setText( "Error writing to " + path );
Status.setText( res.getString(R.string.error_write, path) );
return false;
}
@@ -302,13 +309,13 @@ class DataDownloader extends Thread
String percent = "";
if( totalLen > 0 )
percent = String.valueOf(stream.getBytesRead() * 100 / totalLen) + "%: ";
Status.setText( percent + "writing file " + path );
Status.setText( res.getString(R.string.dl_progress, percent, path) );
}
out.flush();
out.close();
out = null;
} catch( java.io.IOException e ) {
Status.setText( "Error writing file " + path + " from URL " + url );
Status.setText( res.getString(R.string.error_write, path) );
return false;
}
}
@@ -322,7 +329,7 @@ class DataDownloader extends Thread
try {
entry = zip.getNextEntry();
} catch( java.io.IOException e ) {
Status.setText( "Error downloading data from " + url );
Status.setText( res.getString(R.string.error_dl_from, url) );
return false;
}
if( entry == null )
@@ -359,14 +366,14 @@ class DataDownloader extends Thread
} catch( SecurityException e ) { };
if( out == null )
{
Status.setText( "Error writing to " + path );
Status.setText( res.getString(R.string.error_write, path) );
return false;
}
String percent = "";
if( totalLen > 0 )
percent = String.valueOf(stream.getBytesRead() * 100 / totalLen) + "%: ";
Status.setText( percent + "writing file " + path );
Status.setText( res.getString(R.string.dl_progress, percent, path) );
try {
int len = zip.read(buf);
@@ -379,13 +386,13 @@ class DataDownloader extends Thread
percent = "";
if( totalLen > 0 )
percent = String.valueOf(stream.getBytesRead() * 100 / totalLen) + "%: ";
Status.setText( percent + "writing file " + path );
Status.setText( res.getString(R.string.dl_progress, percent, path) );
}
out.flush();
out.close();
out = null;
} catch( java.io.IOException e ) {
Status.setText( "Error writing file " + path + " from URL " + url );
Status.setText( res.getString(R.string.error_write, path) );
return false;
}
@@ -401,7 +408,7 @@ class DataDownloader extends Thread
}
} catch( Exception e )
{
Status.setText( "CRC32 check failed for file " + path );
Status.setText( res.getString(R.string.error_write, path) );
return false;
}
}
@@ -417,10 +424,10 @@ class DataDownloader extends Thread
} catch( FileNotFoundException e ) {
} catch( SecurityException e ) {
} catch( java.io.IOException e ) {
Status.setText( "Error writing file " + path );
Status.setText( res.getString(R.string.error_write, path) );
return false;
};
Status.setText( "Finished" );
Status.setText( res.getString(R.string.dl_finished) );
try {
stream.close();

View File

@@ -23,7 +23,7 @@ public class MainActivity extends Activity {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
_tv = new TextView(this);
_tv.setText("Initializing");
_tv.setText(R.string.init);
setContentView(_tv);
if(mAudioThread == null) // Starting from background (should not happen)
{

View File

@@ -13,13 +13,16 @@ import android.util.Log;
import java.io.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.os.Environment;
import android.os.StatFs;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import java.lang.String;
class Settings
{
@@ -80,8 +83,9 @@ class Settings
settingsLoaded = true;
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Phone configuration");
builder.setPositiveButton("Change phone configuration", new DialogInterface.OnClickListener()
builder.setTitle(p.getResources().getString(R.string.device_config));
builder.setPositiveButton(p.getResources().getString(R.string.device_change_cfg),
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
@@ -166,7 +170,8 @@ class Settings
freePhone = (long)phone.getAvailableBlocks() * phone.getBlockSize() / 1024 / 1024;
}catch(Exception e) {}
final CharSequence[] items = {"Phone storage - " + String.valueOf(freePhone) + " Mb free", "SD card - " + String.valueOf(freeSdcard) + " Mb free"};
final CharSequence[] items = { p.getResources().getString(R.string.storage_phone, freePhone),
p.getResources().getString(R.string.storage_sd, freeSdcard) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
builder.setTitle(downloadFiles[0].split("[|]")[0]);
@@ -188,9 +193,6 @@ class Settings
static void showOptionalDownloadConfig(final MainActivity p) {
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
System.out.println("downloadFiles.length " + String.valueOf(downloadFiles.length));
for(int i = 0; i < downloadFiles.length; i++)
System.out.println("downloadFiles[" + String.valueOf(i) + "] = '" + downloadFiles[i] + "'");
if(downloadFiles.length <= 1)
{
Globals.OptionalDataDownload = new boolean[1];
@@ -200,7 +202,7 @@ class Settings
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Optional packages");
builder.setTitle(p.getResources().getString(R.string.optional_downloads));
CharSequence[] items = new CharSequence[ downloadFiles.length - 1 ];
for(int i = 1; i < downloadFiles.length; i++ )
@@ -214,19 +216,13 @@ class Settings
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
System.out.println("Globals.OptionalDataDownload: set item " + String.valueOf(item + 1) + " to " + String.valueOf(isChecked));
Globals.OptionalDataDownload[item+1] = isChecked;
}
});
builder.setPositiveButton("Done", new DialogInterface.OnClickListener()
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
System.out.println("Globals.OptionalDataDownload len" + String.valueOf(Globals.OptionalDataDownload.length));
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
System.out.println("Globals.OptionalDataDownload[" + String.valueOf(i) + "] = '" + String.valueOf(Globals.OptionalDataDownload[i]) + "'");
dialog.dismiss();
showKeyboardConfig(p);
}
@@ -245,10 +241,12 @@ class Settings
return;
}
final CharSequence[] items = {"Arrows / joystick / dpad", "Trackball", "None, only touchscreen"};
final CharSequence[] items = { p.getResources().getString(R.string.controls_arrows),
p.getResources().getString(R.string.controls_trackball),
p.getResources().getString(R.string.controls_touch) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("What kind of navigation keys does your phone have?");
builder.setTitle(p.getResources().getString(R.string.controls_question));
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -274,10 +272,13 @@ class Settings
return;
}
final CharSequence[] items = {"No dampening", "Fast", "Medium", "Slow"};
final CharSequence[] items = { p.getResources().getString(R.string.trackball_no_dampening),
p.getResources().getString(R.string.trackball_fast),
p.getResources().getString(R.string.trackball_medium),
p.getResources().getString(R.string.trackball_slow) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Trackball dampening");
builder.setTitle(p.getResources().getString(R.string.trackball_question));
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -301,25 +302,31 @@ class Settings
return;
}
final CharSequence[] items = {
"On-screen keyboard" /* + ( Globals.AppUsesMouse ? " (disables mouse input)" : "") */ ,
"Accelerometer as navigation keys" /* + ( Globals.AppUsesJoystick ? " (disables joystick input)" : "" ) */ ,
"Both accelerometer and on-screen keyboard",
"No additional controls"
p.getResources().getString(R.string.controls_screenkb),
p.getResources().getString(R.string.controls_accelnav),
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Additional controls to use");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
builder.setTitle(p.getResources().getString(R.string.controls_additional));
builder.setMultiChoiceItems(items, null, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
if( item == 0 )
Globals.UseTouchscreenKeyboard = isChecked;
if( item == 1 )
Globals.UseAccelerometerAsArrowKeys = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.UseTouchscreenKeyboard = (item == 0 || item == 2);
Globals.UseAccelerometerAsArrowKeys = (item == 1 || item == 2);
dialog.dismiss();
showAccelerometerConfig(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
@@ -334,10 +341,12 @@ class Settings
return;
}
final CharSequence[] items = {"Fast", "Medium", "Slow"};
final CharSequence[] items = { p.getResources().getString(R.string.accel_fast),
p.getResources().getString(R.string.accel_medium),
p.getResources().getString(R.string.accel_slow) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Accelerometer sensitivity");
builder.setTitle(R.string.accel_question);
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -362,10 +371,13 @@ class Settings
return;
}
final CharSequence[] items = {"Big", "Medium", "Small", "Tiny"};
final CharSequence[] items = { p.getResources().getString(R.string.controls_screenkb_large),
p.getResources().getString(R.string.controls_screenkb_medium),
p.getResources().getString(R.string.controls_screenkb_small),
p.getResources().getString(R.string.controls_screenkb_tiny) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("On-screen keyboard size (toggle auto-fire by sliding across Fire button)");
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_size));
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -390,10 +402,13 @@ class Settings
return;
}
final CharSequence[] items = {"Ultimate Droid by Sean Stieber", "Ugly Arrows by pelya"};
final CharSequence[] items = {
p.getResources().getString(R.string.controls_screenkb_by, "Ultimate Droid", "Sean Stieber"),
p.getResources().getString(R.string.controls_screenkb_by, "Ugly Arrows", "pelya")
};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("On-screen keyboard theme");
builder.setTitle(p.getResources().getString(R.string.controls_screenkb_theme));
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -414,10 +429,12 @@ class Settings
static void showAudioConfig(final MainActivity p)
{
final CharSequence[] items = {"Small (fast devices)", "Medium", "Large (if sound is choppy)"};
final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_small),
p.getResources().getString(R.string.audiobuf_medium),
p.getResources().getString(R.string.audiobuf_large) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Size of audio buffer");
builder.setTitle(R.string.audiobuf_question);
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)