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

Kaitag language support #519

Merged
merged 11 commits into from
Feb 27, 2024
Merged

Kaitag language support #519

merged 11 commits into from
Feb 27, 2024

Conversation

alkaitagi
Copy link
Contributor

@alkaitagi alkaitagi commented Feb 21, 2024

This PR adds typing support for Kaitag, a minority language spoken in the Caucasus region.

Changes per layouts.md:

  • Added kaitag.txt layout file using the simple format
  • Added layout entry with imeSubtypeLocale & languageTag set to the ISO code xdq
  • Added xdq.txt to configure the popup keys

@alkaitagi
Copy link
Contributor Author

alkaitagi commented Feb 21, 2024

I've built & tested it locally. The typing works, which is amazing. There are a few issues though:

  1. I think because the language doesn't have the global locale / 2-letter code, the app can't know what name to display and uses the ISO code (xdq) I've used. Then were should I put the proper name?
  1. The single layout's name and the spacebar text display xdq as well. Here too where should I put Kaitag?

  2. On the layout I've added vowels keys with acute diacritic, it's not that important, just convenient to show word stress. However these acute-vowels display over the base punctuation hints (e.g. о́ instead of +), but not over the number row hints. Is there a way to keep those layout hints below without user having to manually order the hint sources in the language settings? Again, it's not super important, if there's no support for it then I'll just delete these.

@alkaitagi
Copy link
Contributor Author

Also I'd like to add multilingual typing support for Russian language (which our alphabet is based on), but I couldn't find any instructions on it here.

@Helium314
Copy link
Owner

I think because the language doesn't have the global locale / 2-letter code, the app can't know what name to display and uses the ISO code (xdq) I've used. Then were should I put the proper name?

You can do it like Hinglish, which is using android:label="@string/subtype_hi_Latn". You would need to add a string for subtype_xdq. The name should be used everywhere, as far as I remember.

For 3, you can adjust the hint order for each layout (but currently not the default order).
I would also recomment to put о́ and similar into the language_key_texts file instead of the layout (see description in https://github.com/Helium314/HeliBoard/blob/main/layouts.md#adding-new-layouts--languages)

Also I'd like to add multilingual typing support for Russian language (which our alphabet is based on), but I couldn't find any instructions on it here.

It should work if you add xdq to cyrillic script in https://github.com/Helium314/HeliBoard/blob/main/app/src/main/java/helium314/keyboard/latin/utils/ScriptUtils.kt#L158

@alkaitagi
Copy link
Contributor Author

Spent an hour tracking all the Hinglish resources and creating similar Kaitag entries nearby. Still can't make it work everywhere.

image

sorry, have no experience with native Android

@Helium314
Copy link
Owner

It looks like there is some other place where you need to put the name:
Try donottranslate.xml, probably you need to add it to subtype_locale_exception_keys, subtype_locale_displayed_in_root_locale and add subtype_in_root_locale_xdq.

I'll have a closer look at this later, for now it appears to be an unnecessary trap when adding such a locale that is unknown to the system...

@alkaitagi
Copy link
Contributor Author

Thanks, I'm one step closer! Now just need to figure out the "Languages & Layouts" list item text.

image

@Helium314
Copy link
Owner

I think I found it: in LocaleUtils.getLocaleDisplayNameInSystemLocale, try replacing if (locale.script() != locale.language.constructLocale().script()) { with if (locale.script() != locale.language.constructLocale().script() || locale.language == "xdg") {

@alkaitagi
Copy link
Contributor Author

alkaitagi commented Feb 24, 2024

Yes, it works. Thank you very much for your assistance!

But this is a hack, obviously, and I don't feel good about merging this. What do you say?

@alkaitagi
Copy link
Contributor Author

Further, I think some refactoring & code update is needed to streamline this whole process. For underrepresented and unrecognized minority languages (like mine) projects like this one do really come to rescue.

@Helium314
Copy link
Owner

But this is a hack, obviously, and I don't feel good about merging this. What do you say?

I don't see a really good other way... maybe having a map of locales that need special treatment instead of the current check. But that's nothing to worry about in this PR.

Further, I think some refactoring & code update is needed to streamline this whole process.

I agree, though it may take some time to simplify the process for such contributions. (and currently I don't nearly have enough time for this project)
For now I'll update the documentation to at least avoid the next contributor running into the same issues.

@Helium314 Helium314 merged commit 056ba37 into Helium314:main Feb 27, 2024
@alkaitagi
Copy link
Contributor Author

The work is so incredible I might as well learn native Android to help you with this. Please, keep it up.

@alkaitagi alkaitagi deleted the kaitag branch February 27, 2024 10:28
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.

None yet

2 participants