Permalink
Browse files

Make template for differnet languages varnam

  • Loading branch information...
malayaleecoder committed Aug 23, 2016
1 parent db8c226 commit 6646a1859883a5d20da14d94cdce276f9f46cfd2
@@ -12,8 +12,10 @@

public class Varnam{

private String engineName;
public String transliterate(String input) {
String starting = "https://api.varnamproject.com/tl/ml/";
String starting = "https://api.varnamproject.com/tl/";
starting = starting + getLanguage() + "/";
String urlstring = starting + input;

try {
@@ -35,11 +37,32 @@ public String transliterate(String input) {
}
}

public void setEngineName(String engineName1) {
engineName = engineName1;
}
public String getEngineName() {
return engineName;
}
public String getLanguage() {
if(engineName.equals("ml-varnam"))
return "ml";
else if(engineName.equals("ta-varnam"))
return "ta";
return "";
}
public int getMaxKeyLength() {
return 4;
if(engineName.equals("ml-varnam"))
return 4;
else if(engineName.equals("ta-varnam"))
return 4;
return -1;
}

public int getContextLength() {
return 2;
if(engineName.equals("ml-varnam"))
return 2;
else if(engineName.equals("ta-varnam"))
return 2;
return -1;
}
}
@@ -113,8 +113,9 @@ public void setTransliterationMethod(InputMethod transliterationMethod) {
mTransliterationEngine = null;
}

public void setTransliterationEngine(Varnam vm) {
public void setTransliterationEngine(Varnam vm, String transliterationEngine) {
mTransliterationEngine = vm;
mTransliterationEngine.setEngineName(transliterationEngine);
mTransliterationMethod = null;
}
/**
@@ -279,9 +280,8 @@ public void applyTransliterationByEngine (final Event event) {
}
}
else if (mTransliterationEngine != null && Constants.CODE_DELETE == event.mKeyCode) {
if(finalword.length() == 0) {
if (finalword.length() == 0)
finalword = finalword.substring(0, finalword.length() - 1);
}
}
}

@@ -2312,7 +2312,7 @@ public void enableTransliteration(String transliterationMethod, Context context)
public void enableTransliterationByEngine(String transliterationEngine, Context context) {
try {
Varnam vm = new Varnam();
mWordComposer.setTransliterationEngine(vm);
mWordComposer.setTransliterationEngine(vm, transliterationEngine);
isTransliteration = true;
} catch (Exception e) {
e.printStackTrace();

0 comments on commit 6646a18

Please sign in to comment.