Skip to content

refactor: decouple language layout assumptions from GeneralKeyboardIME (Part 5/6) (#426) - #673

Merged
andrewtavis merged 1 commit into
scribe-org:mainfrom
prince-0408:refactor/decouple-layout-assumptions-426
Aug 14, 2026
Merged

refactor: decouple language layout assumptions from GeneralKeyboardIME (Part 5/6) (#426)#673
andrewtavis merged 1 commit into
scribe-org:mainfrom
prince-0408:refactor/decouple-layout-assumptions-426

Conversation

@prince-0408

@prince-0408 prince-0408 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR is Part 5 of 6 in modularizing GeneralKeyboardIME for #426.

It removes hardcoded language name checks ("English", "Russian", "Swedish", "German") for layout configurations (like conjugate view grid size and plural capitalization) from GeneralKeyboardIME.kt and decouples them into overridable configuration properties in language subclasses.

Detailed Changes Table:

File / Component Changes Applied Detailed Impact
GeneralKeyboardIME.kt Introduced open configuration properties (defaultConjugateModeType: String = "3x2", defaultConjugateLayoutXML: Int = R.xml.conjugate_view_3x2, isPluralCapitalized: Boolean = false) and removed all hardcoded language name checks. Completely decouples layout rules from the base class.
EnglishKeyboardIME.kt Overrode defaultConjugateModeType = "2x2" and defaultConjugateLayoutXML = R.xml.conjugate_view_2x2. Declares 2x2 layout explicitly in English IME subclass.
RussianKeyboardIME.kt Overrode defaultConjugateModeType = "2x2" and defaultConjugateLayoutXML = R.xml.conjugate_view_2x2. Declares 2x2 layout explicitly in Russian IME subclass.
SwedishKeyboardIME.kt Overrode defaultConjugateModeType = "2x2" and defaultConjugateLayoutXML = R.xml.conjugate_view_2x2. Declares 2x2 layout explicitly in Swedish IME subclass.
GermanKeyboardIME.kt Overrode isPluralCapitalized = true. Declares plural capitalization behavior explicitly in German IME subclass.

Key Benefits:

  • Decoupled Architecture: GeneralKeyboardIME contains zero hardcoded assumptions or when (language) checks for layout configurations.
  • Extensibility: Adding future language keyboards requires zero modifications to GeneralKeyboardIME.kt.
  • Zero Behavioral / API Breakage: Preserves exact layout rendering and plural capitalization across all languages.

Related Issue

Refactors part of #426

@andrewtavis andrewtavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Changes are great, @prince-0408! Thanks so much for your support here and the dedication to all of these refactors! 😊

@andrewtavis
andrewtavis merged commit b6cc6c5 into scribe-org:main Aug 14, 2026
7 checks passed
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