Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Piedmontese language #748

Merged
merged 4 commits into from
Apr 29, 2024
Merged

Add Piedmontese language #748

merged 4 commits into from
Apr 29, 2024

Conversation

glemco
Copy link
Contributor

@glemco glemco commented Apr 24, 2024

This PR adds support for Piedmontese.
Considering it's using latin script, the name is displayed by android and no new layout is needed, I hope I'm not missing any modification (tested locally and seems to work fine).

I didn't find any information regarding how common a language should be to be included in the keyboard, this language is definitely not common (but present on Gboard and swipe, for instance), is it alright to include support relying on a downloadable dictionary? I'll create a follow-up PR in https://codeberg.org/Helium314/aosp-dictionaries

@Helium314
Copy link
Owner

the name is displayed by android and no new layout is needed

So e.g. in the language settings, the displayed name is Piedmontese and not pms? I remember we had such a problem for the Kaitag language...

I didn't find any information regarding how common a language should be to be included in the keyboard

Additional languages basically do not add any relevant load or size, so even uncommon languages are welcome (Kaitag has even less speakers than Piedmontese).

Is it alright to include support relying on a downloadable dictionary? I'll create a follow-up PR in https://codeberg.org/Helium314/aosp-dictionaries

Sure, you're welcome to add it there!

@glemco
Copy link
Contributor Author

glemco commented Apr 26, 2024

So e.g. in the language settings, the displayed name is Piedmontese and not pms? I remember we had such a problem for the Kaitag language...

Ok that gets tricky, it does work fine in Italian, English and French, but it only shows pms in Spanish.
Now I wouldn't mind if it was not present in other language (there are virtually no Piedmontese speakers would main language wouldn't be one of those), but there's a substantial group of Piedmontese speakers in some Latin American countries (Argentina, Uruguay, etc.).
Do we have a way around this? Like if a language name in the current system language is just 3 letters long (or doesn't have a name, whatever is easy), we display it in English as fallback?

Additional languages basically do not add any relevant load or size, so even uncommon languages are welcome (Kaitag has even less speakers than Piedmontese).

Perfect, let's carry on then! (That's interesting, wonder how doesn't it qualify as endangered, but that's a question for another day..)

Sure, you're welcome to add it there!

Great, will do. Do I use the experimental folders?

@Helium314
Copy link
Owner

Ok that gets tricky, it does work fine in Italian, English and French, but it only shows pms in Spanish. Now I wouldn't mind if it was not present in other language (there are virtually no Piedmontese speakers would main language wouldn't be one of those), but there's a substantial group of Piedmontese speakers in some Latin American countries (Argentina, Uruguay, etc.). Do we have a way around this? Like if a language name in the current system language is just 3 letters long (or doesn't have a name, whatever is easy), we display it in English as fallback?

This is a really weird situation... I had not expected something like that.
The language translations are part of the Android System. Which Android version are you using?

Detecting that display name is the same as language code is easy, a fall back to English should not be hard to implement.

Great, will do. Do I use the experimental folders?

That's your choice. I usually add the ones I create to the experimantal folder because my scripts to create them seem to have issues, and the dictionaries contain some unwanted words.
If you think your Piedmontese dictionary is good to use, put it in the normal folder.

@glemco
Copy link
Contributor Author

glemco commented Apr 27, 2024

I am running android 14 (lineageos 21), not sure if it would make sense to test this on different versions, I don't have access to older devices..
Anyway gboard added support for piedmontese several years ago so I'd not think it's something new.

@Helium314
Copy link
Owner

Could you try changing

+        val localeDisplayName = locale.getDisplayName(context.resources.configuration.locale())
+        return if (localeDisplayName == languageTag)
+            locale.displayName
+        else localeDisplayName
-        return locale.getDisplayName(context.resources.configuration.locale())

at the end of LocaleUtils.getLocaleDisplayNameInSystemLocale? Then hopefully instead of pms you get the English Piedmontese for Spanish.
Possibly you need to use locale.displayName(Locale.US) instead of locale.displayName.

@glemco
Copy link
Contributor Author

glemco commented Apr 29, 2024

Seems to work fine, thanks!
We are missing the change on another point:

Basically after that change, if I search and enable the language, I see the name in English, but I don't from the main page, I don't know exactly where to touch for that. Could it be because somehow it's displayed uppercase over there?
Once I have a little more time I'll verify that (just changing the case to both at the time we check in LocaleUtils).

UPDATE
Tried in the last commit and it didn't fix..

Gabriele Monaco and others added 2 commits April 29, 2024 14:32
related changes done in separate commit
@Helium314
Copy link
Owner

Ugh, this is really horrible to deal with.
Should be working with 4476456

@Helium314 Helium314 merged commit 5cffb0b into Helium314:main Apr 29, 2024
1 check passed
@glemco
Copy link
Contributor Author

glemco commented Apr 30, 2024

Yeah neater out of this PR, thanks for merging and working on it!

@glemco glemco deleted the piedmontese branch May 31, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants