Browse Source

Better handle of string to avoid static string in code

Add language english by default and french as second supported languague
tags/release_v1
Schoumi 5 years ago
parent
commit
bed99964f6
5 changed files with 77 additions and 29 deletions
  1. +2
    -0
      .gitignore
  2. +3
    -3
      app/src/main/java/fr/mobdev/gobelim/NetworkManager.java
  3. +1
    -1
      app/src/main/java/fr/mobdev/gobelim/activity/MainActivity.java
  4. +41
    -0
      app/src/main/res/values-fr/strings.xml
  5. +30
    -25
      app/src/main/res/values/strings.xml

+ 2
- 0
.gitignore View File

@@ -1,3 +1,5 @@
*.apk

# Generated files
bin/
gen/


+ 3
- 3
app/src/main/java/fr/mobdev/gobelim/NetworkManager.java View File

@@ -109,7 +109,7 @@ public class NetworkManager {
conn = (HttpURLConnection) url.openConnection();
}
else {
listener.fileUploadError("Connection Failed");
listener.fileUploadError(context.getString(R.string.connection_failed));
return null;
}
String location = conn.getHeaderField("Location");
@@ -165,7 +165,7 @@ public class NetworkManager {
}
} catch (IOException e1) {
e1.printStackTrace();
listener.fileUploadError("Network Error");
listener.fileUploadError(context.getString(R.string.network_error));
}

if(stream != null) {
@@ -215,7 +215,7 @@ public class NetworkManager {
}
} catch (JSONException e) {
e.printStackTrace();
listener.fileUploadError("JSON Unreadable");
listener.fileUploadError(context.getString(R.string.unreadable_json));
}
}
return imgOutput;


+ 1
- 1
app/src/main/java/fr/mobdev/gobelim/activity/MainActivity.java View File

@@ -281,7 +281,7 @@ public class MainActivity extends ActionBarActivity {
NetworkManager.getInstance(listener, getApplicationContext()).upload(url, delete, fileName, bytearray);
}
else {
listener.fileUploadError("Empty file or Unable to read the file");
listener.fileUploadError(getString(R.string.empty_file));
}
}



+ 41
- 0
app/src/main/res/values-fr/strings.xml View File

@@ -0,0 +1,41 @@
<resources>
<string name="app_name">Gobelim</string>

<string name="action_settings">Paramètres</string>
<string name="title_activity_share">Partager</string>
<string name="title_activity_history">Historique</string>
<string name="title_activity_link">Partager le lien</string>
<string name="title_activity_servers">Liste des serveurs</string>
<string name="upload_pict">Envoyer</string>
<string name="select_pict">Selectionner une Image</string>
<string name="duration">durée de\nConservation</string>
<string name="copy_to_clipboard">Lien copié dans le presse-papier</string>
<string name="server_title">Ajouter un serveur</string>
<string name="url">Adresse du site</string>
<string name="add_server">Ajouter un serveur</string>
<string name="manage_server">Gérer les serveurs</string>
<string name="show_history">Voir l\'historique</string>
<string name="delete_server_message">Supprimer le serveur</string>
<string name="upload_progress">Envoi en cours</string>
<string name="no_duration">\u221E</string>
<string name="duration_ended">Supprimée</string>
<string name="days">Jours restants</string>
<string name="day">Jour restant</string>
<string name="server_list_error">Vous n\'avez aucun serveur configuré, merci d\'en ajouter un</string>
<string name="network_error">Erreur Réseau</string>
<string name="connection_failed">Echec de Connexion</string>
<string name="unreadable_json">JSON Illisible</string>
<string name="empty_file">Fichier vide ou impossible à lire</string>
<string name="too_large_file">Le fichier est peut être trop grand</string>
<string-array name="deleted_days">
<item>Pas de limitation</item>
<item>24 Heures</item>
<item>7 Jours</item>
<item>30 Jours</item>
<item>1 an</item>
</string-array>
<string-array name="https">
<item>http://</item>
<item>https://</item>
</string-array>
</resources>

+ 30
- 25
app/src/main/res/values/strings.xml View File

@@ -1,33 +1,38 @@
<resources>
<string name="app_name">Gobelim</string>

<string name="action_settings">Paramètres</string>
<string name="title_activity_share">Partager</string>
<string name="title_activity_history">Historique</string>
<string name="title_activity_link">Partager le lien</string>
<string name="title_activity_servers">Liste des serveurs</string>
<string name="upload_pict">Envoyer</string>
<string name="select_pict">Selectionner une Image</string>
<string name="duration">durée de\nConservation</string>
<string name="copy_to_clipboard">Lien copié dans le presse-papier</string>
<string name="server_title">Ajouter un serveur</string>
<string name="url">Adresse du site</string>
<string name="add_server">Ajouter un serveur</string>
<string name="manage_server">Gérer les serveurs</string>
<string name="show_history">Voir l\'historique</string>
<string name="delete_server_message">Supprimer le server</string>
<string name="upload_progress">Envoi en cours</string>
<string name="action_settings">Parameters</string>
<string name="title_activity_share">Share</string>
<string name="title_activity_history">History</string>
<string name="title_activity_link">Share the link</string>
<string name="title_activity_servers">Servers List</string>
<string name="upload_pict">Upload</string>
<string name="select_pict">Pick an Image</string>
<string name="duration">Storage\nDuration</string>
<string name="copy_to_clipboard">Link copy to clipboard</string>
<string name="server_title">Add a server</string>
<string name="url">Site Url</string>
<string name="add_server">Add a server</string>
<string name="manage_server">Manage servers</string>
<string name="show_history">Show history</string>
<string name="delete_server_message">Delete the server</string>
<string name="upload_progress">Upload in progress</string>
<string name="no_duration">\u221E</string>
<string name="duration_ended">Supprimée</string>
<string name="days">Jours restants</string>
<string name="day">Jour restant</string>
<string name="server_list_error">Vous n\'avez aucun serveur configuré, merci d\'en ajouter un</string>
<string name="duration_ended">Deleted</string>
<string name="days">Remaining Days</string>
<string name="day">Remaining Day</string>
<string name="server_list_error">You haven\'t any configured server, please add one</string>
<string name="network_error">Network Error</string>
<string name="connection_failed">Connection Fail</string>
<string name="unreadable_json">Unreadable JSON</string>
<string name="empty_file">Empty file or unable to read it</string>
<string name="too_large_file">The file may be too large</string>
<string-array name="deleted_days">
<item>Pas de limitation</item>
<item>24 Heures</item>
<item>7 Jours</item>
<item>30 Jours</item>
<item>1 an</item>
<item>No limitation</item>
<item>24 Hours</item>
<item>7 Days</item>
<item>30 Days</item>
<item>1 Year</item>
</string-array>
<string-array name="https">
<item>http://</item>


Loading…
Cancel
Save