Make errors in WallaBase.js translatable

pull/1/head
Grégory Oestreicher 2016-12-20 15:21:23 +01:00
parent 762e17021a
commit 449e862c93
3 changed files with 48 additions and 10 deletions

View File

@ -97,7 +97,7 @@ function getServer( id, cb )
try { try {
var res = tx.executeSql( "SELECT id, name, url, lastSync FROM servers WHERE id=?", [ id ] ); var res = tx.executeSql( "SELECT id, name, url, lastSync FROM servers WHERE id=?", [ id ] );
if ( res.rows.length === 0 ) { if ( res.rows.length === 0 ) {
err = "No server with this ID found"; err = qsTr( "Server not found in the configuration" );
} }
else { else {
server = res.rows.item( 0 ); server = res.rows.item( 0 );
@ -123,7 +123,7 @@ function getServerSettings( id, cb )
try { try {
var res = tx.executeSql( "SELECT * FROM servers WHERE id=?", [ id ] ); var res = tx.executeSql( "SELECT * FROM servers WHERE id=?", [ id ] );
if ( res.rows.length === 0 ) { if ( res.rows.length === 0 ) {
err = "No server with this ID found"; err = qsTr( "Server not found in the configuration" );
} }
else { else {
server = res.rows.item( 0 ); server = res.rows.item( 0 );
@ -224,7 +224,7 @@ function connectToServer( id, cb )
try { try {
var res = tx.executeSql( "SELECT url, user, password, clientId, clientSecret FROM servers WHERE id=?", [ id ] ); var res = tx.executeSql( "SELECT url, user, password, clientId, clientSecret FROM servers WHERE id=?", [ id ] );
if ( res.rows.length === 0 ) { if ( res.rows.length === 0 ) {
err = "No server with ID " + id + " found"; err = qsTr( "Server not found in the configuration" );
} }
else { else {
_sendAuthRequest( res.rows.item( 0 ), cb ); _sendAuthRequest( res.rows.item( 0 ), cb );
@ -267,7 +267,7 @@ function _sendAuthRequest( props, cb )
} }
catch( e ) { catch( e ) {
json = null; json = null;
err = "Failed to parse server response: " + e.message err = qsTr( "Failed to parse server response: " ) + e.message
} }
} }
else { else {
@ -280,7 +280,7 @@ function _sendAuthRequest( props, cb )
} }
} }
err = "HTTP request failed: " + http.status; err = qsTr( "Server reply was " ) + "'" + http.statusText + "'";
} }
cb( json, err ); cb( json, err );
@ -424,7 +424,7 @@ function articleExists( server, id, cb )
exists = ( res.rows[0].count === 0 ? false : true ); exists = ( res.rows[0].count === 0 ? false : true );
} }
else { else {
err = "Failed to get article from database when checking its existence"; err = qsTr( "Article not found in the cache" );
} }
} }
catch( e ) { catch( e ) {
@ -548,7 +548,7 @@ function uploadNewArticle( props, articleUrl, cb )
} }
catch( e ) { catch( e ) {
json = null; json = null;
err = "failed to parse server response"; err = qsTr( "Failed to parse server response: " ) + e.message;
} }
if ( err !== null ) if ( err !== null )
@ -563,7 +563,7 @@ function uploadNewArticle( props, articleUrl, cb )
) )
} }
else { else {
err = "server returned '" + http.statusText + "'"; err = qsTr( "Server reply was " ) + "'" + http.statusText + "'";
} }
cb( json, err ); cb( json, err );
@ -634,7 +634,7 @@ function _downloadNextArticles( url, token, page, cb )
} }
catch( e ) { catch( e ) {
json = null; json = null;
err = "Failed to parse server response: " + e.message err = qsTr( "Failed to parse server response: " ) + e.message
} }
} }
else { else {
@ -647,7 +647,7 @@ function _downloadNextArticles( url, token, page, cb )
} }
} }
err = "HTTP request failed: " + http.status; err = qsTr( "Server reply was " ) + "'" + http.statusText + "'";
} }
cb( articles, done, err ); cb( articles, done, err );

View File

@ -169,4 +169,23 @@
<translation>Aucun serveur trouvé, utilisez le menu coulissant et sélectionnez &apos;Nouveau serveur&apos;</translation> <translation>Aucun serveur trouvé, utilisez le menu coulissant et sélectionnez &apos;Nouveau serveur&apos;</translation>
</message> </message>
</context> </context>
<context>
<name>WallaBase</name>
<message>
<source>Server not found in the configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to parse server response: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server reply was </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Article not found in the cache</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS> </TS>

View File

@ -169,4 +169,23 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>WallaBase</name>
<message>
<source>Server not found in the configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Failed to parse server response: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Server reply was </source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Article not found in the cache</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS> </TS>