Language selector

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Language selector

Post by kamil_w » 22 Mar 2019 11:39

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?
Attachments
SmartSelect_20190322-122348.jpg
What I want to get.
SmartSelect_20190322-122348.jpg (86.35 KiB) Viewed 723 times
SmartSelect_20190322-121945.jpg
How does it look now
SmartSelect_20190322-121945.jpg (57.51 KiB) Viewed 723 times
Screenshot_20190322-121911.jpg
A flow.
Screenshot_20190322-121911.jpg (624.3 KiB) Viewed 723 times

User avatar
Desmanto
Posts: 1757
Joined: 21 Jul 2017 17:50

Re: Language selector

Post by Desmanto » 22 Mar 2019 17:17

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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190512, Pie 9.0, Rooted.

kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Re: Language selector

Post by kamil_w » 22 Mar 2019 17:23

Thanks. I will try it.

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

anuraag
Posts: 216
Joined: 24 Jan 2015 02:06

Re: Language selector

Post by anuraag » 23 Mar 2019 00:00

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.

safracatz
Posts: 3
Joined: 04 Mar 2019 09:52
Contact:

Re: Language selector

Post by safracatz » 26 Mar 2019 12:24

A language switcher enables visitors to choose the language in which they want to read your content. Lets you join a language switcher in different ways: in a menu, as a widget, or in the site’s footer. You can also use it to give links above or below your posts, offering them in other languages.

kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Re: Language selector

Post by kamil_w » 26 Mar 2019 12:32

Sorry, I don't understand.

shreyathakare
Posts: 1
Joined: 09 Feb 2019 05:19

Re: Language selector

Post by shreyathakare » 28 Mar 2019 04:55

I was not able to understand the explaination.
can you please explain in detail

safracatz
Posts: 3
Joined: 04 Mar 2019 09:52
Contact:

Re: Language selector

Post by safracatz » 04 Apr 2019 09:38

Language Selector: Allows your users to determine a language option for your website. Geographic Map Selector: Leaves your users to pick a nation and language from a world map.

kamil_w
Posts: 50
Joined: 22 Oct 2013 19:01

Re: Language selector

Post by kamil_w » 04 Apr 2019 11:12

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.

Post Reply