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

Gujarati phonetic layout #562

Merged
merged 7 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions check_layout.output
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Layout doesn't define some important keys, missing: f11_placeholder, f12_placeho
# grek_qwerty
Duplicate keys: ;
1 warnings
# guj_phonetic_in
Duplicate keys: ટ, ડ
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# hang_dubeolsik_kr
0 warnings
# hebr_1_il
Expand Down
3 changes: 3 additions & 0 deletions res/values/layouts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<item>deva_alt</item>
<item>deva_inscript</item>
<item>grek_qwerty</item>
<item>guj_phonetic_in</item>
<item>hang_dubeolsik_kr</item>
<item>hebr_1_il</item>
<item>hebr_2_il</item>
Expand Down Expand Up @@ -74,6 +75,7 @@
<item>देवनागरी (हिंदी)-2</item>
<item>देवनागरी (हिंदी)-1</item>
<item>QWERTY (Greek)</item>
<item>ગુજરાતી ફોનેટિક - Gujarati Phonetic</item>
<item>두벌식 (Korean)</item>
<item>Hebrew 1</item>
<item>Hebrew 2</item>
Expand Down Expand Up @@ -126,6 +128,7 @@
<item>@xml/deva_alt</item>
<item>@xml/deva_inscript</item>
<item>@xml/grek_qwerty</item>
<item>@xml/guj_phonetic_in</item>
<item>@xml/hang_dubeolsik_kr</item>
<item>@xml/hebr_1_il</item>
<item>@xml/hebr_2_il</item>
Expand Down
47 changes: 47 additions & 0 deletions srcs/juloo.keyboard2/KeyModifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static Map_char modify_numpad_script(String numpad_script)
case "bengali": return map_char_numpad_bengali;
case "devanagari": return map_char_numpad_devanagari;
case "persian": return map_char_numpad_persian;
case "gujarati": return map_char_numpad_gujarati;
default: return map_char_none;
}
}
Expand Down Expand Up @@ -503,6 +504,31 @@ private static char map_char_shift(char c)
has the inconvenient of swapping i and ı on the keyboard. */
case 'ı': return 'İ';
case '₹': return '₨';
// Gujarati alternate characters
case 'અ': return 'આ';
case 'ઇ': return 'ઈ';
case 'િ': return 'ી';
case 'ઉ': return 'ઊ';
case 'ુ': return 'ૂ';
case 'એ': return 'ઐ';
case 'ે': return 'ૈ';
case 'ઓ': return 'ઔ';
case 'ો': return 'ૌ';
case 'ક': return 'ખ';
case 'ગ': return 'ઘ';
case 'ચ': return 'છ';
case 'જ': return 'ઝ';
case 'ટ': return 'ઠ';
case 'ડ': return 'ઢ';
case 'ન': return 'ણ';
case 'ત': return 'થ';
case 'દ': return 'ધ';
case 'પ': return 'ફ';
case 'બ': return 'ભ';
case 'મ': return 'ં';
case 'લ': return 'ળ';
case 'સ': return 'શ';
case 'હ': return 'ઃ';
default: return c;
}
}
Expand Down Expand Up @@ -1098,4 +1124,25 @@ public String apply(char c)
}
}
};

private static final Map_char map_char_numpad_gujarati =
new Map_char() {
public String apply(char c)
{
switch (c)
{
case '0': return "૦";
case '1': return "૧";
case '2': return "૨";
case '3': return "૩";
case '4': return "૪";
case '5': return "૫";
case '6': return "૬";
case '7': return "૭";
case '8': return "૮";
case '9': return "૯";
default: return null;
}
}
};
}
37 changes: 37 additions & 0 deletions srcs/layouts/guj_phonetic_in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<keyboard name="ગુજરાતી ફોનેટિક - Gujarati Phonetic" script="gujarati">
<row>
Copy link
Owner

Choose a reason for hiding this comment

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

The top row doesn't look good in combination to the built-in number row (that can be enabled in the settings). Do you think every users of this layout will want to have this row ?

Also, the layout is very high due to top row. It takes almost half of the screen on my device. You can make the top row a bit smaller with height="0.75" (like the built-in number row).

Copy link
Contributor Author

@Yogesh-B Yogesh-B Feb 18, 2024

Choose a reason for hiding this comment

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

Screenshot_2024-02-18-22-29-59-773_com.github.android.jpg

we can do something like this to remove the top row. [**also as you see in the Screen Shot, numbers are shown properly in keyboard but output is not in devanagari. I feel like there is a bug. Devanagari numbers work fine in normal view, just this number view is not working proper]

normal working in below view:
Screenshot_2024-02-18-22-38-30-500_com.github.android.jpg

Copy link
Owner

Choose a reason for hiding this comment

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

The devanagari digits are specified here: https://github.com/Julow/Unexpected-Keyboard/blob/master/srcs/juloo.keyboard2/KeyModifier.java#L1060
Are they wrong ?

To change the numpad digits when your layout is visible, you'd need to add a new similar map and call it from here: https://github.com/Julow/Unexpected-Keyboard/blob/master/srcs/juloo.keyboard2/KeyModifier.java#L100

Copy link
Contributor Author

@Yogesh-B Yogesh-B Feb 28, 2024

Choose a reason for hiding this comment

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

The first screen shot just shows the layout in Devanagari(or any other language), but when typing, it puts output as english numbers. I think it is using values from https://github.com/Julow/Unexpected-Keyboard/blob/master/res/xml/numeric.xml .

I tried adding Gujarati number in the java file you suggested, but had same issue as mentioned above.

Edit: just tested by adding Gujarati numbers to the numeric.xml , it is outputting values we define there. the KeyModifier.java->modify_numpad_script is just for UI part. actual output comes from xml mapping.
(Sorry but I am not a android/java/kotlin developer, just did some debugging. : )

Copy link
Owner

Choose a reason for hiding this comment

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

You are right, there's a serious bug in the numpad. I fixed it in 8c7559d and fixed the number row in 8b5d971.

You can now remove the number row from your layout and enable the number row in the settings.

Note that the layout must also contain the numerals for people that don't use the number row option.

<key key0="ટ" key1="`" key2="1" key3="!" key4="esc"/>
Copy link
Owner

Choose a reason for hiding this comment

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

The western numerals are on the keyboard instead of the gujarati ones. Is this intended ?

<key key0="ડ" key1="~" key2="2" key3="\@" key4="\#"/>
<key key0="ે" key1="એ" key2="3" key3="$" key4="૱"/>
<key key0="ર" key1="ઋ" key2="4" key3="ૃ" key4="₹"/>
<key key0="ત" key1="ટ" key2="5" key3="%"/>
<key key0="ય" key2="6" key3="^"/>
<key key0="ુ" key1="ઉ" key2="7" key3="&amp;"/>
<key key0="િ" key1="ઇ" key2="8" key3="*" key4="ઁ"/>
<key key0="ો" key1="ઓ" key2="9" key3="(" key4=")"/>
<key key0="પ" key1="૰" key2="0" key4="॒"/>
</row>
<row>
<key shift="0.5" key0="ા" key1="tab" key3="અ"/>
<key key0="સ" key1="“" key4="”"/>
<key key0="દ" key1="ડ"/>
<key key0="્" key1="ૠ" key3="ૄ"/>
<key key0="ગ" key2="-" key3="_"/>
<key key0="હ" key2="=" key3="+"/>
<key key0="જ" key3="{" key4="}"/>
<key key0="ક" key1="ૢ" key2="ૡ" key3="[" key4="]"/>
<key key0="લ" key1="।" key2="|" key3="\\" key4="॥"/>
</row>
<row>
<key width="1.5" key0="shift" key2="loc capslock"/>
<key key0="ઞ" key1="જ્ઞ" key2="ૅ" key3="ઙ" key4="ઍ"/>
<key key0="ષ" key1="ક્ષ" key2="ૉ" key3="઼" key4="ઑ"/>
<key key0="ચ" key2="&lt;" key3="."/>
<key key0="વ" key2=">" key3=","/>
<key key0="બ" key2="\?" key3="/"/>
<key key0="ન" key2=":" key3=";"/>
<key key0="મ" key1="ૐ" key2="&quot;" key3="'" key4="॑" key6="ઽ"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>