Make action key labels translatable

This commit is contained in:
Jules Aguillon 2022-01-23 19:19:38 +01:00
parent 28f98cc129
commit cb95e99f50
2 changed files with 14 additions and 6 deletions

View File

@ -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>

View File

@ -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)