Page 1 of 1

Language selector

Posted: 22 Mar 2019 11:39
by kamil_w
Hi.
I am trying to create fancy and automated input dialog to choose UI language based on existing language files.

It works fine, but I would like to polish it a little bit.

Right now list in dialog shows county codes (ex. pl_PL) which are taken from filenames.

What I would like to achieve is to get on list:
Country flag + country name
instead of
Country code.



My idea to do this was presented here:
http://automagic4android.com/forum/view ... 6&t=7960&p



However it needs improvements.
1. Else{} create an "unknown" position even if there is no other element on the list.
2. Else{} create just one position on the list even if there is more unrecognized elements.
3. And maybe it can be done in different way than by loop if...else.


Do you have any advices?

Re: Language selector

Posted: 22 Mar 2019 17:17
by Desmanto
I don't know how to add icon to the input dialog, maybe some java can do it and I am not good at it.

If you want the country name only, to be mapped to their language code, you can use the similar mapping method.

Code: Select all

langcode = newMapFromValues(
"Polski", "pl_PL",
"English (British)", "en_GB",
"Italiano", "it_IT",
"Unknown", "xx_XX" );

choice = getMapKeys(langcode);
use {choice,listformat,comma} in the input dialog field

Then after getting the value, you can use langcode[value] to get the language code.

You can also reverse the key and value if you want. You can also dynamically create the key from the file list available, but you must decide the pattern first.

Re: Language selector

Posted: 22 Mar 2019 17:23
by kamil_w
Thanks. I will try it.

FYI: Those flags are taken from emoji icons from built-in Samsung keyboard.

Re: Language selector

Posted: 23 Mar 2019 00:00
by anuraag
kamil_w wrote:Thanks. I will try it.

FYI: Those flags are taken from emoji icons from built-in Samsung keyboard.
You can add flag emojis before country names. It will show in input dialog.

Re: Language selector

Posted: 26 Mar 2019 12:32
by kamil_w
Sorry, I don't understand.

Re: Language selector

Posted: 28 Mar 2019 04:55
by shreyathakare
I was not able to understand the explaination.
can you please explain in detail

Re: Language selector

Posted: 04 Apr 2019 11:12
by kamil_w
My idea is to create a menu in Automagic, which will be activated by Automagic Destop Shortcut. It based on Input Dialog and looks this way:

Menu:
<status> <functionality>
<status> <functionality>
...
<options>


Where <status> shows if functionality is on or off, and <functionality> is a name of set of flows.
And in <options> user can choose an UI language.



I was working on it, because I wanted to learn Automagic in more advance way and I want to have a menu launched by pressing a Bixby button in my Samsung Note8.


So, safracatz, I don't understand why you write about langauge on a website.