Commit 2d8257d3 authored by Mygod's avatar Mygod

Localize new strings in drawer

parent 3da69947
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
android:layout_gravity="top" android:layout_gravity="top"
app:srcCompat="@drawable/ic_social_share" app:srcCompat="@drawable/ic_social_share"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Share" android:contentDescription="@string/share"
android:focusable="true" android:focusable="true"
android:nextFocusLeft="@+id/container"/> android:nextFocusLeft="@+id/container"/>
<android.support.v7.widget.AppCompatImageView android:id="@+id/edit" <android.support.v7.widget.AppCompatImageView android:id="@+id/edit"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
android:layout_gravity="top" android:layout_gravity="top"
app:srcCompat="@drawable/ic_image_edit" app:srcCompat="@drawable/ic_image_edit"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Edit" android:contentDescription="@string/edit"
android:focusable="true"/> android:focusable="true"/>
</LinearLayout> </LinearLayout>
<LinearLayout android:layout_width="match_parent" <LinearLayout android:layout_width="match_parent"
......
...@@ -42,7 +42,10 @@ ...@@ -42,7 +42,10 @@
<string name="stopping">正在关闭……</string> <string name="stopping">正在关闭……</string>
<string name="vpn_error">后台服务启动失败:%s</string> <string name="vpn_error">后台服务启动失败:%s</string>
<string name="reboot_required">VPN 服务启动失败。你可能需要重启设备。</string> <string name="reboot_required">VPN 服务启动失败。你可能需要重启设备。</string>
<string name="yes"></string>
<string name="no"></string>
<string name="close">关闭</string> <string name="close">关闭</string>
<string name="profile_empty">请选择配置文件</string>
<string name="proxy_empty">代理服务器地址及密码不能为空</string> <string name="proxy_empty">代理服务器地址及密码不能为空</string>
<string name="connect">连接</string> <string name="connect">连接</string>
<string name="initializing">正在初始化……</string> <string name="initializing">正在初始化……</string>
...@@ -59,6 +62,7 @@ ...@@ -59,6 +62,7 @@
<string name="flush_dnscache_summary">只需在 NAT 模式下使用,需要 ROOT 权限</string> <string name="flush_dnscache_summary">只需在 NAT 模式下使用,需要 ROOT 权限</string>
<string name="flush_dnscache_no_root">在没有 ROOT 权限的情况下无法刷新 DNS 缓存</string> <string name="flush_dnscache_no_root">在没有 ROOT 权限的情况下无法刷新 DNS 缓存</string>
<string name="flushing">刷新中……</string> <string name="flushing">刷新中……</string>
<string name="edit">编辑</string>
<string name="share">分享</string> <string name="share">分享</string>
<string name="share_message">扫描二维码或使用 Android Beam (NFC)</string> <string name="share_message">扫描二维码或使用 Android Beam (NFC)</string>
<string name="share_message_without_nfc">扫描二维码</string> <string name="share_message_without_nfc">扫描二维码</string>
...@@ -95,6 +99,9 @@ ...@@ -95,6 +99,9 @@
<string name="profile_manager_dialog_content">&#8226; 点击选择配置文件;\n&#8226; 向左/右滑动或按左删除;\n&#8226; <string name="profile_manager_dialog_content">&#8226; 点击选择配置文件;\n&#8226; 向左/右滑动或按左删除;\n&#8226;
长按拖动改变顺序。</string> 长按拖动改变顺序。</string>
<string name="gotcha">好的</string> <string name="gotcha">好的</string>
<string name="profile_config">配置文件设置</string>
<string name="unsaved_changes_prompt">保存修改吗?</string>
<string name="delete_confirm_prompt">你是否确定要删除这个配置文件?</string>
<string name="copy_url">复制 URL</string> <string name="copy_url">复制 URL</string>
<string name="add_profile_dialog">为影梭添加此配置文件?</string> <string name="add_profile_dialog">为影梭添加此配置文件?</string>
<string name="add_profile_methods_scan_qr_code">扫描二维码</string> <string name="add_profile_methods_scan_qr_code">扫描二维码</string>
......
...@@ -43,7 +43,10 @@ ...@@ -43,7 +43,10 @@
<string name="stopping">關閉中……</string> <string name="stopping">關閉中……</string>
<string name="vpn_error">%s</string> <string name="vpn_error">%s</string>
<string name="reboot_required">VPN 服務啟動失敗。您或許需要重新啟動您的裝置。</string> <string name="reboot_required">VPN 服務啟動失敗。您或許需要重新啟動您的裝置。</string>
<string name="yes"></string>
<string name="no"></string>
<string name="close">關閉</string> <string name="close">關閉</string>
<string name="profile_empty">請選擇設定檔</string>
<string name="proxy_empty">Proxy 或密碼不可以空白</string> <string name="proxy_empty">Proxy 或密碼不可以空白</string>
<string name="connect">連線</string> <string name="connect">連線</string>
<string name="initializing">起始中……</string> <string name="initializing">起始中……</string>
...@@ -60,6 +63,7 @@ ...@@ -60,6 +63,7 @@
<string name="flush_dnscache_summary">僅在 NAT 模式可用,需要 ROOT 權限</string> <string name="flush_dnscache_summary">僅在 NAT 模式可用,需要 ROOT 權限</string>
<string name="flush_dnscache_no_root">在無 ROOT 權限時清除 DNS 快取無法進行</string> <string name="flush_dnscache_no_root">在無 ROOT 權限時清除 DNS 快取無法進行</string>
<string name="flushing">清除中……</string> <string name="flushing">清除中……</string>
<string name="edit">編輯</string>
<string name="share">分享</string> <string name="share">分享</string>
<string name="share_message">掃描 QR 碼或者使用 Android Beam (NFC)</string> <string name="share_message">掃描 QR 碼或者使用 Android Beam (NFC)</string>
<string name="share_message_without_nfc">掃描 QR 碼</string> <string name="share_message_without_nfc">掃描 QR 碼</string>
...@@ -96,6 +100,9 @@ ...@@ -96,6 +100,9 @@
<string name="profile_manager_dialog_content">&#8226; 輕觸選擇一個設定檔;\n&#8226; 向左/右撥動或按左移除;\n&#8226; <string name="profile_manager_dialog_content">&#8226; 輕觸選擇一個設定檔;\n&#8226; 向左/右撥動或按左移除;\n&#8226;
按住後上下撥動設定檔重新排序。</string> 按住後上下撥動設定檔重新排序。</string>
<string name="gotcha">我懂了!</string> <string name="gotcha">我懂了!</string>
<string name="profile_config">設定檔配置</string>
<string name="unsaved_changes_prompt">要保存更改嗎?</string>
<string name="delete_confirm_prompt">您確定要移除這個設定檔嗎?</string>
<string name="copy_url">複製 URL</string> <string name="copy_url">複製 URL</string>
<string name="add_profile_dialog">為 Shadowsocks 新增此設定檔?</string> <string name="add_profile_dialog">為 Shadowsocks 新增此設定檔?</string>
<string name="add_profile_methods_scan_qr_code">掃描 QR 碼</string> <string name="add_profile_methods_scan_qr_code">掃描 QR 碼</string>
......
...@@ -83,9 +83,13 @@ ...@@ -83,9 +83,13 @@
<string name="vpn_error">%s</string> <string name="vpn_error">%s</string>
<string name="reboot_required">Failed to start VPN service. You might need to reboot your device.</string> <string name="reboot_required">Failed to start VPN service. You might need to reboot your device.</string>
<string name="quick_switch">Switch</string> <string name="quick_switch">Switch</string>
<string name="profile_invalid_input">No valid profile data found.</string>
<!-- alert category --> <!-- alert category -->
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="close">Close</string> <string name="close">Close</string>
<string name="profile_empty">Please select a profile</string>
<string name="proxy_empty">Proxy/Password should not be empty</string> <string name="proxy_empty">Proxy/Password should not be empty</string>
<string name="connect">Connect</string> <string name="connect">Connect</string>
<string name="initializing">Initializing…</string> <string name="initializing">Initializing…</string>
...@@ -100,6 +104,7 @@ ...@@ -100,6 +104,7 @@
<string name="recovery_summary">Reset all the background services</string> <string name="recovery_summary">Reset all the background services</string>
<string name="about">About</string> <string name="about">About</string>
<string name="about_title">Shadowsocks %s</string> <string name="about_title">Shadowsocks %s</string>
<string name="edit">Edit</string>
<string name="share">Share</string> <string name="share">Share</string>
<string name="share_message">Scan QR code or use Android Beam (NFC)</string> <string name="share_message">Scan QR code or use Android Beam (NFC)</string>
<string name="share_message_without_nfc">Scan QR code</string> <string name="share_message_without_nfc">Scan QR code</string>
...@@ -123,6 +128,9 @@ ...@@ -123,6 +128,9 @@
<string name="profile_manager_dialog_content">&#8226; Tap to select a profile;\n&#8226; Swipe left/right or press left <string name="profile_manager_dialog_content">&#8226; Tap to select a profile;\n&#8226; Swipe left/right or press left
to remove;\n&#8226; Long press to reorder profiles.</string> to remove;\n&#8226; Long press to reorder profiles.</string>
<string name="gotcha">Gotcha!</string> <string name="gotcha">Gotcha!</string>
<string name="profile_config">Profile config</string>
<string name="unsaved_changes_prompt">Changes not saved. Do you want to save?</string>
<string name="delete_confirm_prompt">Are you sure you want to remove this profile?</string>
<string name="add_profile_dialog">Add this Shadowsocks Profile?</string> <string name="add_profile_dialog">Add this Shadowsocks Profile?</string>
<string name="add_profile_methods_scan_qr_code">Scan QR code</string> <string name="add_profile_methods_scan_qr_code">Scan QR code</string>
<string name="add_profile_methods_manual_settings">Manual Settings</string> <string name="add_profile_methods_manual_settings">Manual Settings</string>
......
...@@ -113,7 +113,7 @@ trait BaseService extends Service { ...@@ -113,7 +113,7 @@ trait BaseService extends Service {
override def use(profileId: Int): Unit = synchronized(if (profileId < 0) stopRunner(stopService = true) else { override def use(profileId: Int): Unit = synchronized(if (profileId < 0) stopRunner(stopService = true) else {
val profile = app.profileManager.getProfile(profileId).orNull val profile = app.profileManager.getProfile(profileId).orNull
if (profile == null) stopRunner(stopService = true, "Please select a profile.") else state match { // TODO: localize if (profile == null) stopRunner(stopService = true, getString(R.string.profile_empty)) else state match {
case State.STOPPED => if (checkProfile(profile)) startRunner(profile) case State.STOPPED => if (checkProfile(profile)) startRunner(profile)
case State.CONNECTED => if (profileId != BaseService.this.profile.id && checkProfile(profile)) { case State.CONNECTED => if (profileId != BaseService.this.profile.id && checkProfile(profile)) {
stopRunner(stopService = false) stopRunner(stopService = false)
......
...@@ -99,7 +99,6 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe ...@@ -99,7 +99,6 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
case _: NullPointerException => case _: NullPointerException =>
} }
private def changeState(s: Int, profileName: String = null, m: String = null) { private def changeState(s: Int, profileName: String = null, m: String = null) {
// TODO: localize texts for statusText in this method
s match { s match {
case State.CONNECTING => case State.CONNECTING =>
fab.setImageResource(R.drawable.ic_start_busy) fab.setImageResource(R.drawable.ic_start_busy)
...@@ -314,17 +313,17 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe ...@@ -314,17 +313,17 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
if (TextUtils.isEmpty(sharedStr)) return if (TextUtils.isEmpty(sharedStr)) return
val profiles = Parser.findAll(sharedStr).toList val profiles = Parser.findAll(sharedStr).toList
if (profiles.isEmpty) { if (profiles.isEmpty) {
// TODO: show error msg Snackbar.make(findViewById(R.id.snackbar), R.string.profile_invalid_input, Snackbar.LENGTH_LONG).show()
return return
} }
val dialog = new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setTitle(R.string.add_profile_dialog) .setTitle(R.string.add_profile_dialog)
.setPositiveButton("Yes", ((_, _) => // TODO .setPositiveButton(R.string.yes, ((_, _) =>
profiles.foreach(app.profileManager.createProfile)): DialogInterface.OnClickListener) profiles.foreach(app.profileManager.createProfile)): DialogInterface.OnClickListener)
.setNegativeButton("No", null) .setNegativeButton(R.string.no, null)
.setMessage(profiles.mkString("\n")) .setMessage(profiles.mkString("\n"))
.create() .create()
dialog.show() .show()
} }
def onSharedPreferenceChanged(pref: SharedPreferences, key: String): Unit = key match { def onSharedPreferenceChanged(pref: SharedPreferences, key: String): Unit = key match {
......
...@@ -35,7 +35,7 @@ class ProfileConfigActivity extends Activity { ...@@ -35,7 +35,7 @@ class ProfileConfigActivity extends Activity {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.layout_profile_config) setContentView(R.layout.layout_profile_config)
val toolbar = findViewById(R.id.toolbar).asInstanceOf[Toolbar] val toolbar = findViewById(R.id.toolbar).asInstanceOf[Toolbar]
toolbar.setTitle("Profile config") // TODO toolbar.setTitle(R.string.profile_config)
toolbar.setNavigationIcon(R.drawable.ic_navigation_close) toolbar.setNavigationIcon(R.drawable.ic_navigation_close)
toolbar.setNavigationOnClickListener(_ => onBackPressed()) toolbar.setNavigationOnClickListener(_ => onBackPressed())
toolbar.inflateMenu(R.menu.profile_config_menu) toolbar.inflateMenu(R.menu.profile_config_menu)
...@@ -43,9 +43,9 @@ class ProfileConfigActivity extends Activity { ...@@ -43,9 +43,9 @@ class ProfileConfigActivity extends Activity {
} }
override def onBackPressed(): Unit = if (app.settings.getBoolean(Key.dirty, false)) new AlertDialog.Builder(this) override def onBackPressed(): Unit = if (app.settings.getBoolean(Key.dirty, false)) new AlertDialog.Builder(this)
.setTitle("Changes not saved. Do you want to save?") // TODO: localizations .setTitle(R.string.unsaved_changes_prompt)
.setPositiveButton("Yes", ((_, _) => child.saveAndExit()): DialogInterface.OnClickListener) .setPositiveButton(R.string.yes, ((_, _) => child.saveAndExit()): DialogInterface.OnClickListener)
.setNegativeButton("No", ((_, _) => finish()): DialogInterface.OnClickListener) .setNegativeButton(R.string.no, ((_, _) => finish()): DialogInterface.OnClickListener)
.setNeutralButton(android.R.string.cancel, null) .setNeutralButton(android.R.string.cancel, null)
.create() .create()
.show() else super.onBackPressed() .show() else super.onBackPressed()
......
...@@ -83,12 +83,12 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe ...@@ -83,12 +83,12 @@ class ProfileConfigFragment extends PreferenceFragment with OnMenuItemClickListe
override def onMenuItemClick(item: MenuItem): Boolean = item.getItemId match { override def onMenuItemClick(item: MenuItem): Boolean = item.getItemId match {
case R.id.action_delete => case R.id.action_delete =>
new AlertDialog.Builder(getActivity) new AlertDialog.Builder(getActivity)
.setTitle("Confirm?") // TODO .setTitle(R.string.delete_confirm_prompt)
.setPositiveButton("Yes", ((_, _) => { .setPositiveButton(R.string.yes, ((_, _) => {
app.profileManager.delProfile(profile.id) app.profileManager.delProfile(profile.id)
getActivity.finish() getActivity.finish()
}): DialogInterface.OnClickListener) }): DialogInterface.OnClickListener)
.setNegativeButton("No", null) .setNegativeButton(R.string.no, null)
.create() .create()
.show() .show()
true true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment