Bug 1019719 - Localize the Sync client name. r=nalexander

This commit is contained in:
Bryan Kok 2014-07-21 11:13:24 -07:00
Родитель e782441df2
Коммит bc1dc47d08
6 изменённых файлов: 27 добавлений и 8 удалений

Просмотреть файл

@ -348,7 +348,7 @@ public class FxAccountStatusFragment
}
this.fxAccount = fxAccount;
try {
this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs());
this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs(), getActivity().getApplicationContext());
} catch (Exception e) {
Logger.error(LOG_TAG, "Got exception fetching Sync prefs associated to Firefox Account; aborting.", e);
// Something is terribly wrong; best to get a stack trace rather than

Просмотреть файл

@ -357,7 +357,7 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
FxAccountGlobalSession globalSession = null;
try {
final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs);
final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs, getContext());
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
FxAccountConstants.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'.");
FxAccountConstants.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp());

Просмотреть файл

@ -74,6 +74,13 @@
<!-- Account strings -->
<!ENTITY sync.account.label '&syncBrand.fullName.label; (deprecated)'>
<!-- Localization note (sync.default.client.name): Default string of the "Device name" menu item upon setting up Firefox Sync.
The placeholder &formatS1 will be replaced by the name of the Firefox release channel and &formatS2 by the model name of the
Android device. Examples:
Aurora on GT-I1950
Fennec on MI 2S -->
<!ENTITY sync.default.client.name '&formatS1; on &formatS2;'>
<!-- Bookmark folder strings -->
<!ENTITY bookmarks.folder.menu.label 'Bookmarks Menu'>
<!ENTITY bookmarks.folder.places.label ''>

Просмотреть файл

@ -6,7 +6,9 @@ package org.mozilla.gecko.sync;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.sync.delegates.ClientsDataDelegate;
import org.mozilla.gecko.R;
import android.content.Context;
import android.content.SharedPreferences;
/**
@ -15,9 +17,11 @@ import android.content.SharedPreferences;
*/
public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate {
protected final SharedPreferences sharedPreferences;
protected final Context context;
public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences) {
public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences, Context context) {
this.sharedPreferences = sharedPreferences;
this.context = context;
}
@Override
@ -46,8 +50,15 @@ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate
@Override
public String getDefaultClientName() {
// Bug 1019719: localize this string!
return GlobalConstants.MOZ_APP_DISPLAYNAME + " on " + android.os.Build.MODEL;
String name = GlobalConstants.MOZ_APP_DISPLAYNAME;
if (name.contains("Aurora")) {
name = "Aurora";
} else if (name.contains("Beta")) {
name = "Beta";
} else if (name.contains("Nightly")) {
name = "Nightly";
}
return context.getResources().getString(R.string.sync_default_client_name, name, android.os.Build.MODEL);
}
@Override

Просмотреть файл

@ -341,7 +341,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements BaseGlob
final String profile = Constants.DEFAULT_PROFILE;
final long version = SyncConfiguration.CURRENT_PREFS_VERSION;
self.accountSharedPreferences = Utils.getSharedPreferences(mContext, product, username, serverURL, profile, version);
self.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(accountSharedPreferences);
self.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(accountSharedPreferences, mContext);
self.backoffHandler = new PrefsBackoffHandler(accountSharedPreferences, SyncConstants.BACKOFF_PREF_SUFFIX_11);
final String nodeWeaveURL = Utils.nodeWeaveURL(serverURL, username);
self.nodeAssignmentDelegate = new SharedPreferencesNodeAssignmentCallback(accountSharedPreferences, nodeWeaveURL);

Просмотреть файл

@ -97,6 +97,7 @@
<string name="sync_text_redirect_to_set_up_sync">&sync.text.redirect.to.set.up.sync.label;</string>
<string name="sync_text_tab_sent">&sync.text.tab.sent.label;</string>
<string name="sync_text_tab_not_sent">&sync.text.tab.not.sent.label;</string>
<string name="sync_default_client_name">&sync.default.client.name;</string>
<string name="browser_intent_package">@ANDROID_PACKAGE_NAME@</string>
<string name="browser_intent_class">@ANDROID_PACKAGE_NAME@.App</string>