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

Update existing incomplete bn-IN layout #1374

Merged
merged 8 commits into from
Mar 6, 2025
Merged

Conversation

RHJihan
Copy link
Contributor

@RHJihan RHJihan commented Feb 18, 2025

The current layout for bn-IN is actually the Bengali Inscript layout. It was incomplete and lacked clarity in its naming and functionality. This update enhances the layout for better usability and completeness.

  • Renamed current bn-IN Inscript layout file bengali.txt to bengali_inscript.json for better clarity, as it was previously unclear without looking at the keyboard.
  • Completed the layout by adding missing Shift key mappings.
  • Modified the layout slightly to better suit mobile usage, as the original was designed for computer keyboards.
  • Updated popup keys and refined punctuation definitions for a more seamless typing experience.
Normal State Shift State

@Helium314
Copy link
Owner

The rename needs to consider that the layout name is stored in preferences, and update the values accordingly.

Further I'm not sure, was the old layout usable / being used?
Because such large changes are disruptive for people who have used the layout for a long time (it has existed like that for more than 10 years in AOSP keyboard).

@RHJihan
Copy link
Contributor Author

RHJihan commented Mar 1, 2025

The rename needs to consider that the layout name is stored in preferences, and update the values accordingly.

Thank you for pointing that out! I wasn’t aware that the layout name is stored in preferences. Could you guide me on how to properly handle the rename to ensure compatibility? I’d be happy to make the necessary adjustments.

Further I'm not sure, was the old layout usable / being used?
Because such large changes are disruptive for people who have used the layout for a long time (it has existed like that for more than 10 years in AOSP keyboard).

As a native Bengali speaker, I can say that most people do not use fixed-layout keyboards for Bengali typing. Instead, they prefer phonetic keyboards, QWERTY for romanization, or popular alternatives like Ridmik Keyboard and GBoard.

Regarding the existing layout, it is Inscript, but it is incomplete and does not meet the standard for a proper Inscript implementation—most notably, it lacks Shift key mappings, which are essential. When I first reviewed it while working on the Baishakhi layout, I found it quite incomplete and unclear.

On standard Inscript keyboards for computers, some Shift-layer keys are left blank. I utilized those spaces to make the layout more practical for mobile users, it's also done in Microsoft SwiftKey. While I understand that changes can be disruptive, the current implementation is not up to standard, and improving it is necessary.

Additionally, issue #900 already mentions that many Indian language layouts, including Bengali, have significant flaws. This update is a step toward fixing that.

Let me know if you have any concerns!

@Helium314
Copy link
Owner

Thank you for pointing that out! I wasn’t aware that the layout name is stored in preferences. Could you guide me on how to properly handle the rename to ensure compatibility? I’d be happy to make the necessary adjustments.

You will need to replace the name in the preference strings Settings.PREF_ENABLED_SUBTYPES, Settings.PREF_SELECTED_SUBTYPE, and Settings.PREF_ADDITIONAL_SUBTYPES.
Upgrading should be done in App.kt, where you can already find plenty of upgrades I recently added to those 3 preferences. If the existing code does not help you enough, I can answer more specific questions.
For the upgrading to work, you will also need to increase the version code in build.gradle.kts.

You can't downgrade the app after version code increase, so I recommend testing by doing a backup with the old version, and then restore it, which will call the upgrade function.

it lacks Shift key mappings, which are essential

Thanks, the shift key was a thing that confused me quite a lot. It was an (I guess supposedly) working keyboard without the shift key, and yet you added / had to add a lot of keys.

While I understand that changes can be disruptive, the current implementation is not up to standard, and improving it is necessary.

Given your points, I agree. Thank you for clarifying!

@RHJihan
Copy link
Contributor Author

RHJihan commented Mar 5, 2025

You will need to replace the name in the preference strings Settings.PREF_ENABLED_SUBTYPES, Settings.PREF_SELECTED_SUBTYPE, and Settings.PREF_ADDITIONAL_SUBTYPES.
Upgrading should be done in App.kt, where you can already find plenty of upgrades I recently added to those 3 preferences. If the existing code does not help you enough, I can answer more specific questions.
For the upgrading to work, you will also need to increase the version code in build.gradle.kts.

You can't downgrade the app after version code increase, so I recommend testing by doing a backup with the old version, and then restore it, which will call the upgrade function.

Thanks for the guidance! I reviewed the recently added upgrade logic and checked App.kt. Since I’m not actually a developer but more of a hobbyist, I wanted to confirm my approach, as it was challenging for me to grasp the whole logic:

if (oldVersion <= 2310) {
    listOf(
        Settings.PREF_ENABLED_SUBTYPES,
        Settings.PREF_SELECTED_SUBTYPE,
        Settings.PREF_ADDITIONAL_SUBTYPES
    ).forEach { key ->
        val value = prefs.getString(key, "")!!
        if ("bengali.txt" in value) {
            prefs.edit().putString(key, value.replace("bengali.txt", "bengali_inscript.json")).apply()
        }
    }
}

So I need to append this here?

Then, I will update the versionCode to 2311 here?

versionCode = 2310

Would this be the correct approach? Thanks again for your help!

@Helium314
Copy link
Owner

Yes, you found the right place and the right things to modify.
The only problem I noticed is that layouts are referenced only by the file name, not including the extension. Unfortunately in your case this is bengali, which means if you user replace it will also apply to other layouts like bengali_akkhor (change to bengalie_inscript_akkhor).

A simple fix would be using replace("bengali,", "bengali_inscript,"). This does not catch 100% of the possible cases, but may only have issues for people who use the current development version (and not 2.3 as released).

@RHJihan
Copy link
Contributor Author

RHJihan commented Mar 6, 2025

Thanks for the explanation. I am going to commit with replace("bengali,", "bengali_inscript,"). It seems a safe workaround.

   if (oldVersion <= 2310) {
    listOf(
        Settings.PREF_ENABLED_SUBTYPES,
        Settings.PREF_SELECTED_SUBTYPE,
        Settings.PREF_ADDITIONAL_SUBTYPES
    ).forEach { key ->
        val value = prefs.getString(key, "")!!
        if ("bengali," in value) {
            prefs.edit().putString(key, value.replace("bengali,", "bengali_inscript,")).apply()
        }
    }
}

@Helium314 Helium314 merged commit 073318d into Helium314:main Mar 6, 2025
1 check passed
@RHJihan RHJihan deleted the inscript branch March 6, 2025 17:25
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