abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorJules Aguillon2022-01-23 19:19:38 +0100
committerJules Aguillon2022-01-23 19:20:02 +0100
commitcb95e99f50ef3065fb8359ac77cc72cc0894a720 (patch)
treeae9e12516b93e573757009ee8356cf63b40e254f
parent28f98cc1298491e1b9133b1e110cfb7ed310dc79 (diff)
downloadunexpected-keyboard-cb95e99f50ef3065fb8359ac77cc72cc0894a720.tar.gz
unexpected-keyboard-cb95e99f50ef3065fb8359ac77cc72cc0894a720.zip
Make action key labels translatable
-rw-r--r--res/values/strings.xml6
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java14
2 files changed, 14 insertions, 6 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 23a691f..c8ae629 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -36,4 +36,10 @@
<string name="pref_swipe_dist_e_default">Normal</string>
<string name="pref_swipe_dist_e_far">Far</string>
<string name="pref_swipe_dist_e_very_far">Very far</string>
+ <string name="key_action_next">Next</string>
+ <string name="key_action_done">Done</string>
+ <string name="key_action_go">Go</string>
+ <string name="key_action_prev">Prev</string>
+ <string name="key_action_search">Search</string>
+ <string name="key_action_send">Send</string>
</resources>
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index fdaa672..06fbed5 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -141,18 +141,20 @@ public class Keyboard2 extends InputMethodService
private String actionLabel_of_imeAction(int action)
{
+ int res;
switch (action)
{
case EditorInfo.IME_ACTION_UNSPECIFIED:
- case EditorInfo.IME_ACTION_NEXT: return "Next";
- case EditorInfo.IME_ACTION_DONE: return "Done";
- case EditorInfo.IME_ACTION_GO: return "Go";
- case EditorInfo.IME_ACTION_PREVIOUS: return "Prev";
- case EditorInfo.IME_ACTION_SEARCH: return "Search";
- case EditorInfo.IME_ACTION_SEND: return "Send";
+ case EditorInfo.IME_ACTION_NEXT: res = R.string.key_action_next; break;
+ case EditorInfo.IME_ACTION_DONE: res = R.string.key_action_done; break;
+ case EditorInfo.IME_ACTION_GO: res = R.string.key_action_go; break;
+ case EditorInfo.IME_ACTION_PREVIOUS: res = R.string.key_action_prev; break;
+ case EditorInfo.IME_ACTION_SEARCH: res = R.string.key_action_search; break;
+ case EditorInfo.IME_ACTION_SEND: res = R.string.key_action_send; break;
case EditorInfo.IME_ACTION_NONE:
default: return null;
}
+ return getResources().getString(res);
}
private void refreshEditorInfo(EditorInfo info)