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; 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());

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

@ -34,7 +34,7 @@
<!ENTITY sync.input.key.label 'Recovery Key'> <!ENTITY sync.input.key.label 'Recovery Key'>
<!ENTITY sync.checkbox.server.label 'Use custom server'> <!ENTITY sync.checkbox.server.label 'Use custom server'>
<!ENTITY sync.input.server.label 'Server URL'> <!ENTITY sync.input.server.label 'Server URL'>
<!-- Setup Fail --> <!-- Setup Fail -->
<!ENTITY sync.title.fail.label 'Cannot Set Up &syncBrand.shortName.label;'> <!ENTITY sync.title.fail.label 'Cannot Set Up &syncBrand.shortName.label;'>
<!ENTITY sync.subtitle.fail.label '&syncBrand.fullName.label; could not connect to the server. Would you like to try again?'> <!ENTITY sync.subtitle.fail.label '&syncBrand.fullName.label; could not connect to the server. Would you like to try again?'>
@ -43,7 +43,7 @@
<!ENTITY sync.subtitle.nointernet.label 'No internet connection available.'> <!ENTITY sync.subtitle.nointernet.label 'No internet connection available.'>
<!ENTITY sync.subtitle.failaccount.label 'Account creation on your device failed.'> <!ENTITY sync.subtitle.failaccount.label 'Account creation on your device failed.'>
<!ENTITY sync.subtitle.failmultiple.label 'Do you have more than one Firefox installed? Currently, &syncBrand.fullName.label; only supports one Firefox installation at a time. Please uninstall other instances to use &syncBrand.shortName.label;.'> <!ENTITY sync.subtitle.failmultiple.label 'Do you have more than one Firefox installed? Currently, &syncBrand.fullName.label; only supports one Firefox installation at a time. Please uninstall other instances to use &syncBrand.shortName.label;.'>
<!-- Setup Success --> <!-- Setup Success -->
<!ENTITY sync.title.success.label 'Setup Complete'> <!ENTITY sync.title.success.label 'Setup Complete'>
<!ENTITY sync.subtitle.success.label1 'Your data is now being downloaded in the background. You can go to Settings to manage your account, or start browsing with &brandShortName;.'> <!ENTITY sync.subtitle.success.label1 'Your data is now being downloaded in the background. You can go to Settings to manage your account, or start browsing with &brandShortName;.'>
@ -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>