зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1019719 - Localize the Sync client name. r=nalexander
This commit is contained in:
Родитель
e782441df2
Коммит
bc1dc47d08
|
@ -348,7 +348,7 @@ public class FxAccountStatusFragment
|
||||||
}
|
}
|
||||||
this.fxAccount = fxAccount;
|
this.fxAccount = fxAccount;
|
||||||
try {
|
try {
|
||||||
this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs());
|
this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs(), getActivity().getApplicationContext());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(LOG_TAG, "Got exception fetching Sync prefs associated to Firefox Account; aborting.", 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
|
// Something is terribly wrong; best to get a stack trace rather than
|
||||||
|
|
|
@ -357,7 +357,7 @@ public class FxAccountSyncAdapter extends AbstractThreadedSyncAdapter {
|
||||||
|
|
||||||
FxAccountGlobalSession globalSession = null;
|
FxAccountGlobalSession globalSession = null;
|
||||||
try {
|
try {
|
||||||
final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs);
|
final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs, getContext());
|
||||||
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
if (FxAccountConstants.LOG_PERSONAL_INFORMATION) {
|
||||||
FxAccountConstants.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'.");
|
FxAccountConstants.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'.");
|
||||||
FxAccountConstants.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp());
|
FxAccountConstants.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp());
|
||||||
|
|
|
@ -74,6 +74,13 @@
|
||||||
<!-- Account strings -->
|
<!-- Account strings -->
|
||||||
<!ENTITY sync.account.label '&syncBrand.fullName.label; (deprecated)'>
|
<!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 -->
|
<!-- Bookmark folder strings -->
|
||||||
<!ENTITY bookmarks.folder.menu.label 'Bookmarks Menu'>
|
<!ENTITY bookmarks.folder.menu.label 'Bookmarks Menu'>
|
||||||
<!ENTITY bookmarks.folder.places.label ''>
|
<!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.background.common.GlobalConstants;
|
||||||
import org.mozilla.gecko.sync.delegates.ClientsDataDelegate;
|
import org.mozilla.gecko.sync.delegates.ClientsDataDelegate;
|
||||||
|
import org.mozilla.gecko.R;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +17,11 @@ import android.content.SharedPreferences;
|
||||||
*/
|
*/
|
||||||
public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate {
|
public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate {
|
||||||
protected final SharedPreferences sharedPreferences;
|
protected final SharedPreferences sharedPreferences;
|
||||||
|
protected final Context context;
|
||||||
|
|
||||||
public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences) {
|
public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences, Context context) {
|
||||||
this.sharedPreferences = sharedPreferences;
|
this.sharedPreferences = sharedPreferences;
|
||||||
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,8 +50,15 @@ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDefaultClientName() {
|
public String getDefaultClientName() {
|
||||||
// Bug 1019719: localize this string!
|
String name = GlobalConstants.MOZ_APP_DISPLAYNAME;
|
||||||
return GlobalConstants.MOZ_APP_DISPLAYNAME + " on " + android.os.Build.MODEL;
|
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
|
@Override
|
||||||
|
|
|
@ -341,7 +341,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements BaseGlob
|
||||||
final String profile = Constants.DEFAULT_PROFILE;
|
final String profile = Constants.DEFAULT_PROFILE;
|
||||||
final long version = SyncConfiguration.CURRENT_PREFS_VERSION;
|
final long version = SyncConfiguration.CURRENT_PREFS_VERSION;
|
||||||
self.accountSharedPreferences = Utils.getSharedPreferences(mContext, product, username, serverURL, profile, 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);
|
self.backoffHandler = new PrefsBackoffHandler(accountSharedPreferences, SyncConstants.BACKOFF_PREF_SUFFIX_11);
|
||||||
final String nodeWeaveURL = Utils.nodeWeaveURL(serverURL, username);
|
final String nodeWeaveURL = Utils.nodeWeaveURL(serverURL, username);
|
||||||
self.nodeAssignmentDelegate = new SharedPreferencesNodeAssignmentCallback(accountSharedPreferences, nodeWeaveURL);
|
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_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_sent">&sync.text.tab.sent.label;</string>
|
||||||
<string name="sync_text_tab_not_sent">&sync.text.tab.not.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_package">@ANDROID_PACKAGE_NAME@</string>
|
||||||
<string name="browser_intent_class">@ANDROID_PACKAGE_NAME@.App</string>
|
<string name="browser_intent_class">@ANDROID_PACKAGE_NAME@.App</string>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче