[android] Added localization support for ru,fr,es,de, closes #444

This commit is contained in:
Alex Zolotarev 2012-02-06 15:50:53 +03:00 committed by Alex Zolotarev
parent d51736a634
commit 9748df36ed
7 changed files with 152 additions and 35 deletions

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="download_maps">Landkarten herunterladen</string>
<string name="my_position">Mein Standort</string>
<string name="app_name">Maps With Me</string>
<string name="about">Über MapsWithMe</string>
<string name="downloading_touch_to_cancel">Heruntergeladen %d%%. Berühren, um abzubrechen</string>
<string name="downloading">Wird heruntergeladen...</string>
<string name="downloaded_touch_to_delete">Heruntergeladen (%s). Berühren, um zu löschen</string>
<string name="touch_to_download">Berühren, um herunterzuladen</string>
<string name="download_has_failed">Download fehlgeschlagen. Bitte versuchen Sie es erneut. </string>
<string name="marked_for_downloading">Wartet auf Download. Berühren, um abzubrechen</string>
<string name="no_internet_connection_detected">Keine Internetverbindung</string>
<string name="connection_settings">Verbindungseinstellungen</string>
<string name="delete">Löschen</string>
<string name="download_mb_or_kb">Herunterladen %s</string>
<string name="cancel_download">Download beenden</string>
<string name="do_nothing">Download fortsetzen</string>
<string name="which_measurement_system">Welches Messsystem ziehen Sie vor?</string>
<string name="miles">Meilen</string>
<string name="kilometres">Kilometer</string>
<string name="close">Schließen</string>
</resources>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="download_maps">Descargar mapas de los países</string>
<string name="my_position">Mi posicion</string>
<string name="app_name">Maps With Me</string>
<string name="about">Sobre MapsWithMe</string>
<string name="downloading_touch_to_cancel">Descarga %d%%, apreté para cancelar</string>
<string name="downloading">Descarga....</string>
<string name="downloaded_touch_to_delete">Descargado (%s), apreté para eliminar</string>
<string name="touch_to_download">Pulse para descargar</string>
<string name="download_has_failed">Erreur du chargement. Appuyez/Sélectionnez pour réessayer.</string>
<string name="marked_for_downloading">Marcado para descarga, apreté para cancelar</string>
<string name="no_internet_connection_detected">No hay conexión al Internet</string>
<string name="connection_settings">Ajustes de conexión</string>
<string name="delete">Eliminar</string>
<string name="download_mb_or_kb">Descargar %s</string>
<string name="cancel_download">Cancelar descarga</string>
<string name="do_nothing">Seguir descarga</string>
<string name="which_measurement_system">¿Cual sistema de medición prefieres?</string>
<string name="miles">Milla</string>
<string name="kilometres">Kilómetros</string>
<string name="close">Cerrar</string>
</resources>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="download_maps">Charger les cartes</string>
<string name="my_position">Mon emplacement</string>
<string name="app_name">Maps With Me</string>
<string name="about">Au sujet des cartes</string>
<string name="downloading_touch_to_cancel">Chargement en cours %d%%, toucher pour annuler</string>
<string name="downloading">Chargement en cours</string>
<string name="downloaded_touch_to_delete">Elle est chargée (%s), Appuyer pour effacer</string>
<string name="touch_to_download">Toucher pour charger</string>
<string name="download_has_failed">Error durante la descarga, iniciar otra vez</string>
<string name="marked_for_downloading">Votre chargement prend la queu, toucher pour annuler</string>
<string name="no_internet_connection_detected">Il n´y a pas de liaison</string>
<string name="connection_settings">Paramètres de connexion</string>
<string name="delete">Effacer</string>
<string name="download_mb_or_kb">Charger %s</string>
<string name="cancel_download">Annuler le chargement</string>
<string name="do_nothing">Continuer de charger</string>
<string name="which_measurement_system">Quel système métrique préférer-vous?</string>
<string name="miles">Milles</string>
<string name="kilometres">Kilomètres</string>
<string name="close">Fermer</string>
</resources>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="download_maps">Загрузить карты стран</string>
<string name="my_position">Моё местоположение</string>
<string name="app_name">Maps With Me</string>
<string name="about">О программе</string>
<string name="downloading_touch_to_cancel">Загружается %d%%, нажмите, чтобы прервать</string>
<string name="downloading">Загружается...</string>
<string name="downloaded_touch_to_delete">Загружено (%s), нажмите для удаления</string>
<string name="mb">Мб</string>
<string name="kb">кб</string>
<string name="touch_to_download">Нажмите для загрузки</string>
<string name="download_has_failed">Ошибка загрузки. Нажмите, чтобы повоторить попытку</string>
<string name="marked_for_downloading">Поставлено в очередь на загрузку, нажмите для отмены</string>
<string name="no_internet_connection_detected">Отсутствует подключение к Интернету</string>
<string name="connection_settings">Настройки подключения</string>
<string name="delete">Удалить</string>
<string name="download_mb_or_kb">Загрузить %s</string>
<string name="cancel_download">Отменить загрузку</string>
<string name="do_nothing">Продолжить загрузку</string>
<string name="which_measurement_system">Какую систему измерения вы предпочитаете?</string>
<string name="miles">Мили</string>
<string name="kilometres">Километры</string>
<string name="close">Закрыть</string>
<string name="external_storage_is_not_available">Загруженные карты недоступны</string>
<string name="disconnect_usb_cable">Отключите USB кабель или вставьте SD-карту</string>
</resources>

View file

@ -1,7 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="download_maps">Download Maps</string>
<string name="my_position">My Position</string>
<string name="app_name">Maps With Me</string>
<string name="about">About MapsWithMe</string>
<string name="downloading_touch_to_cancel">Downloading %d%%, touch to cancel</string>
<string name="downloading">Downloading...</string>
<string name="downloaded_touch_to_delete">Downloaded (%s), touch to delete</string>
<string name="touch_to_download">Touch to download</string>
<string name="mb">Mb</string>
<string name="kb">Kb</string>
<string name="download_has_failed">Download has failed, touch again for one more try</string>
<string name="marked_for_downloading">Marked for downloading, touch to cancel</string>
<string name="no_internet_connection_detected">No Internet connection detected</string>
<string name="connection_settings">Connection Settings</string>
<string name="delete">Delete</string>
<string name="download_mb_or_kb">Download %s</string>
<string name="cancel_download">Cancel download</string>
<string name="do_nothing">Do nothing</string>
<string name="which_measurement_system">Which measurement system do you prefer?</string>
<string name="miles">Miles</string>
<string name="kilometres">Kilometres</string>
<string name="close">Close</string>
<string name="external_storage_is_not_available">External storage memory is not available</string>
<string name="disconnect_usb_cable">Please disconnect USB cable or insert memory card to use MapsWithMe</string>
</resources>

View file

@ -1,6 +1,7 @@
package com.mapswithme.maps;
import com.mapswithme.util.ConnectionState;
import com.mapswithme.maps.R;
import android.app.AlertDialog;
import android.content.DialogInterface;
@ -31,11 +32,19 @@ public class DownloadUI extends PreferenceActivity
private DialogInterface.OnClickListener m_alertCancelHandler = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) { dlg.dismiss(); } };
// Cached resources strings
private String m_kb;
private String m_mb;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Root
m_kb = getString(R.string.kb);
m_mb = getString(R.string.mb);
PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
setPreferenceScreen(createCountriesHierarchy(root, -1, -1, -1));
@ -56,11 +65,11 @@ public class DownloadUI extends PreferenceActivity
private String formatSizeString(long sizeInBytes)
{
if (sizeInBytes > 1024 * 1024)
return sizeInBytes / (1024 * 1024) + " Mb";
return sizeInBytes / (1024 * 1024) + " " + m_mb;
else if ((sizeInBytes + 1023) / 1024 > 999)
return "1 Mb";
return "1 " + m_mb;
else
return (sizeInBytes + 1023) / 1024 + " Kb";
return (sizeInBytes + 1023) / 1024 + " " + m_kb;
}
private void updateCountryCell(final Preference cell, int group, int country, int region)
@ -70,34 +79,28 @@ public class DownloadUI extends PreferenceActivity
switch (status)
{
case 0: // EOnDisk
cell.setSummary("Downloaded (" + formatSizeString(countryLocalSizeInBytes(group, country, region))
+ "), touch to delete");
// ((CheckBoxPreference)cell).setChecked(true);
cell.setSummary(getString(R.string.downloaded_touch_to_delete,
formatSizeString(countryLocalSizeInBytes(group, country, region))));
cell.setLayoutResource(R.layout.country_on_disk);
break;
case 1: // ENotDownloaded
cell.setSummary("Touch to download");// + formatSizeString(countryRemoteSizeInBytes(group, country, region)));
// ((CheckBoxPreference)cell).setChecked(false);
cell.setSummary(getString(R.string.touch_to_download));
cell.setLayoutResource(R.layout.country_not_downloaded);
break;
case 2: // EDownloadFailed
cell.setSummary("Download has failed, touch again for one more try");
cell.setSummary(getString(R.string.download_has_failed));
cell.setLayoutResource(R.layout.country_download_failed);
// ((CheckBoxPreference)cell).setChecked(false);
break;
case 3: // EDownloading
cell.setSummary("Downloading...");
cell.setSummary(getString(R.string.downloading));
cell.setLayoutResource(R.layout.country_downloading);
// ((CheckBoxPreference)cell).setChecked(true);
break;
case 4: // EInQueue
cell.setSummary("Marked for downloading, touch to cancel");
cell.setSummary(getString(R.string.marked_for_downloading));
cell.setLayoutResource(R.layout.country_in_the_queue);
// ((CheckBoxPreference)cell).setChecked(true);
break;
case 5: // EUnknown
cell.setSummary("Unknown state :(");
// ((CheckBoxPreference)cell).setChecked(false);
break;
case 6: // EGeneratingIndex
cell.setSummary("Indexing for search...");
@ -123,7 +126,7 @@ public class DownloadUI extends PreferenceActivity
if (c == null)
Log.d(TAG, String.format("no preference found for %d %d %d", group, country, region));
else
c.setSummary("Downloading " + current * 100 / total + "%, touch to cancel");
c.setSummary(getString(R.string.downloading_touch_to_cancel, current * 100 / total));
}
private Preference createElement(int group, int country, int region)
@ -142,9 +145,7 @@ public class DownloadUI extends PreferenceActivity
else
{ // it's parent element for downloadable countries
PreferenceScreen parent = getPreferenceManager().createPreferenceScreen(this);
// parent.setKey(group + " " + country + " " + region);
parent.setTitle(name);
// parent.setSummary("");
return createCountriesHierarchy(parent, group, country, region);
}
}
@ -166,14 +167,14 @@ public class DownloadUI extends PreferenceActivity
private void showNoConnectionDialog()
{
m_alert.setTitle("Internet connection is not available");
m_alert.setPositiveButton("Connection Settings", new DialogInterface.OnClickListener() {
m_alert.setTitle(getString(R.string.no_internet_connection_detected));
m_alert.setPositiveButton(getString(R.string.connection_settings), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
DownloadUI.this.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
dlg.dismiss();
}
});
m_alert.setNegativeButton("Cancel", m_alertCancelHandler);
m_alert.setNegativeButton(android.R.string.cancel, m_alertCancelHandler);
m_alert.create().show();
}
@ -191,13 +192,13 @@ public class DownloadUI extends PreferenceActivity
{
case 0: // EOnDisk
m_alert.setTitle(countryName(group, country, region));
m_alert.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
m_alert.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
deleteCountry(group, country, region);
dlg.dismiss();
}
});
m_alert.setNegativeButton("Cancel", m_alertCancelHandler);
m_alert.setNegativeButton(android.R.string.cancel, m_alertCancelHandler);
m_alert.create().show();
break;
@ -209,14 +210,14 @@ public class DownloadUI extends PreferenceActivity
else
{ // Display download comfirmation
m_alert.setTitle(countryName(group, country, region));
m_alert.setPositiveButton("Download " + formatSizeString(countryRemoteSizeInBytes(group, country, region)),
m_alert.setPositiveButton(getString(R.string.download_mb_or_kb, formatSizeString(countryRemoteSizeInBytes(group, country, region))),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
downloadCountry(group, country, region);
dlg.dismiss();
}
});
m_alert.setNegativeButton("Cancel", m_alertCancelHandler);
m_alert.setNegativeButton(android.R.string.cancel, m_alertCancelHandler);
m_alert.create().show();
}
break;
@ -232,13 +233,13 @@ public class DownloadUI extends PreferenceActivity
case 3: // EDownloading
/// Confirm canceling
m_alert.setTitle(countryName(group, country, region));
m_alert.setPositiveButton("Cancel download", new DialogInterface.OnClickListener() {
m_alert.setPositiveButton(R.string.cancel_download, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dlg, int which) {
deleteCountry(group, country, region);
dlg.dismiss();
}
});
m_alert.setNegativeButton("Do nothing", m_alertCancelHandler);
m_alert.setNegativeButton(R.string.do_nothing, m_alertCancelHandler);
m_alert.create().show();
break;

View file

@ -86,9 +86,9 @@ public class MWMActivity extends NvEventQueueActivity implements
AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setCancelable(false);
alert.setMessage("Which measurement system do you prefer?");
alert.setMessage(getString(R.string.which_measurement_system));
alert.setButton(AlertDialog.BUTTON_NEGATIVE, "Mi",
alert.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.miles),
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
@ -99,7 +99,7 @@ public class MWMActivity extends NvEventQueueActivity implements
}
});
alert.setButton(AlertDialog.BUTTON_POSITIVE, "Km",
alert.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.kilometres),
new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dlg, int which)
@ -259,7 +259,7 @@ public class MWMActivity extends NvEventQueueActivity implements
builder.setView(alertDialogView);
builder.setTitle(R.string.about);
builder.setPositiveButton("Close", new DialogInterface.OnClickListener() {
builder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
@ -318,8 +318,8 @@ public class MWMActivity extends NvEventQueueActivity implements
if (m_storageDisconnectedDialog == null)
{
m_storageDisconnectedDialog = new AlertDialog.Builder(this).create();
m_storageDisconnectedDialog.setTitle("External storage memory is not available");
m_storageDisconnectedDialog.setMessage("Please disconnect USB cable or insert memory card to use MapsWithMe");
m_storageDisconnectedDialog.setTitle(R.string.external_storage_is_not_available);
m_storageDisconnectedDialog.setMessage(getString(R.string.disconnect_usb_cable));
m_storageDisconnectedDialog.setCancelable(false);
}
m_storageDisconnectedDialog.show();