How to make a transliteration app for Kotlin Android studio
I have a problem with replacement of each element in arrays
button.setOnClickListener {
val string = editText.text.toString()
textView.text = string
belrusToEngTranlit(edittext.toString())
}
fun belrusToEngTranlit(text: String): String? {
val abcCyr = arrayOf("a", "б", "в", "г", "д", "ё", "ж", "з", "и", "к", "л", "м", "н", "п", "р", "с", "т", "у", "ў", "ф", "х", "ц", "ш", "щ", "ы", "э", "ю", "я")
val abcLat = arrayOf("a", "b", "v", "g", "d", "jo", "zh", "z", "i", "k", "l", "m", "n", "p", "r", "s", "t", "u", "w", "f", "h", "ts", "sh", "sch", "", "e", "ju", "ja")
return StringUtils.replaceEach(textView, abcCyr, abcLat)
}
In java I could use StringUtils but in kotlin I can't. What should I use?
See also questions close to this topic
-
How to know if activity is created?
In a project there will be lots of pages(activities) and user will be able to switch between these pages (activities). So when user press the corresponding button that opens page_2 from page_1, I need to create a new Activity. However, if user comes back to page_1 and try to open the page_2 again, there will be a new Activity created again, instead of opening the previously created activity ( I want user to see the page_2 as he/she left it without anychanges). So I want to put something like
if(SecondActivity==null) { //Create new activity } start(new_activity);
Here is the corresponding code ( I couldn't implement onClickListener because I couldn't disable it in
onPause()
method... so I usedonClick
from xml)public class MainActivity extends Activity { private View.OnClickListener openSecondPage = new View.OnClickListener() { @Override public void onClick(View v) { Button button_newPage = findViewById(R.id.button_newpage); button_newPage.setText("Clicked"); Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); startActivity(secondPage); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onResume(){ super.onResume(); //Button button_newPage = findViewById(R.id.button_newpage); // button_newPage.setOnClickListener(openSecondPage); } public void onPause(){ super.onPause(); //Destroy the on click listener Button button_newPage = findViewById(R.id.button_newpage); // button_newPage.setOnClickListener(null); } public void openSecondPage(View v) { Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); startActivity(secondPage); } }
Edit: Here is the new code with Flags:
MainActivity.java code:
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onResume(){ super.onResume(); } public void onPause(){ super.onPause(); } public void openSecondPage(View v) { Intent secondPage = new Intent(getApplicationContext(), SecondActivity.class ); secondPage.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); startActivity(secondPage); } }
SecondActivity.java code:
public class SecondActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.secondactivity); } protected void onResume() { super.onResume(); } public void goBack(View v) { } public void goMainPage(View v) { Intent mainPage = new Intent(getApplicationContext(),MainActivity.class); mainPage.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); startActivity(mainPage); } }
-
Server throwing broken pipe exception
Now I am working on client-server application, client side using exoplayer to request video file from server (struts based server), when the exoplayer first time requesting video source, struts throws IOException: Broken pipe, but it loads the video file successfully on the second try. On server side throws such exception every time the client restarts.
On the some posts, I saw some said that client closing connection, but here exoplayer requests the source and i don't know how to increase timeout for the its connection. Please help me to figure out the problem?
Error:
Jan 26, 2021 3:35:24 PM com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor error SEVERE: java.io.IOException: Broken pipe org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:351) at org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:776) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:298) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:251) at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:157) at org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:305) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:372) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:276) at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:168) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:140) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:575) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcherImpl.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:140) at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101) at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:152) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1261) at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:793) at org.apache.tomcat.util.net.SocketWrapperBase.writeBlocking(SocketWrapperBase.java:563) at org.apache.tomcat.util.net.SocketWrapperBase.write(SocketWrapperBase.java:501) at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.doWrite(Http11OutputBuffer.java:538) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:112) at org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:190) at org.apache.coyote.Response.doWrite(Response.java:601) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:339) ... 77 more
-
Android ACRA crash reporting problem on 4.3 Android version
My application.java looks like this:
@AcraCore(buildConfigClass = BuildConfig.class, reportFormat= StringFormat.JSON) @AcraHttpSender(uri="my_url", httpMethod=org.acra.sender.HttpSender.Method.POST) public class MyApplication extends Application { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); ACRA.init(this); } }
and when I start an app on Android 4.3 (Sony Xperia T) app crashes on
ACRA.init(this)
. I was testing also on Android 9 and there is no problem. This is error log:java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.config.HttpSenderConfigurationBuilderFactory at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:216) at org.acra.plugins.ServicePluginLoader.loadInternal(ServicePluginLoader.java:61) at org.acra.plugins.ServicePluginLoader.load(ServicePluginLoader.java:38) at org.acra.config.BaseCoreConfigurationBuilder.configurationBuilders(BaseCoreConfigurationBuilder.java:58) at org.acra.config.BaseCoreConfigurationBuilder.preBuild(BaseCoreConfigurationBuilder.java:87) at org.acra.config.CoreConfigurationBuilder.build(CoreConfigurationBuilder.java:846) at org.acra.ACRA.init(ACRA.java:160) at org.acra.ACRA.init(ACRA.java:144) at org.acra.ACRA.init(ACRA.java:127) at pl.jawegiel.endlessblow.MyApplication.attachBaseContext(MyApplication.java:18) at android.app.Application.attach(Application.java:181) at android.app.Instrumentation.newApplication(Instrumentation.java:991) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4539) at android.app.ActivityThread.access$1300(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:5225) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.acra.config.HttpSenderConfigurationBuilderFactory" on path: DexPathList[[zip file "/data/app/pl.jawegiel.endlessblow-2.apk"],nativeLibraryDirectories=[/data/app-lib/pl.jawegiel.endlessblow-2, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) at java.lang.ClassLoader.loadClass(ClassLoader.java:501) at java.lang.ClassLoader.loadClass(ClassLoader.java:461) at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:214) at org.acra.plugins.ServicePluginLoader.loadInternal(ServicePluginLoader.java:61) at org.acra.plugins.ServicePluginLoader.load(ServicePluginLoader.java:38) at org.acra.config.BaseCoreConfigurationBuilder.configurationBuilders(BaseCoreConfigurationBuilder.java:58) at org.acra.config.BaseCoreConfigurationBuilder.preBuild(BaseCoreConfigurationBuilder.java:87) at org.acra.config.CoreConfigurationBuilder.build(CoreConfigurationBuilder.java:846) at org.acra.ACRA.init(ACRA.java:160) at org.acra.ACRA.init(ACRA.java:144) at org.acra.ACRA.init(ACRA.java:127) at pl.jawegiel.endlessblow.MyApplication.attachBaseContext(MyApplication.java:18) at android.app.Application.attach(Application.java:181) at android.app.Instrumentation.newApplication(Instrumentation.java:991) at android.app.Instrumentation.newApplication(Instrumentation.java:975) at android.app.LoadedApk.makeApplication(LoadedApk.java:511) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4539) at android.app.ActivityThread.access$1300(ActivityThread.java:150) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:213) at android.app.ActivityThread.main(ActivityThread.java:5225) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525)
and there is many more errors like:
java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.config.DialogConfigurationBuilderFactory java.util.ServiceConfigurationError: Couldn't instantiate class org.acra.collector.ConfigurationCollector Couldn't instantiate class ...
and so on.
What is the minimum Android version required for ACRA crash reporting? But maybe there is another problem?
-
Unable to load class 'org.gradle.api.internal.attributes.DisambiguationRule'. issue in Android Studio version 4.1.2
I am getting the mentioned error in the title when I try to build my Android project.
Here are more the details:
Gradle sync failed: Unable to load class 'org.gradle.api.internal.attributes.DisambiguationRule'. This is an unexpected error. Please file a bug containing the idea.log file. Consult IDE log for more details (Help | Show Log) (10 s 899 ms)
and the exception is:
java.lang.NoClassDefFoundError: org/gradle/api/internal/attributes/DisambiguationRule at org.gradle.api.internal.artifacts.DependencyManagementGlobalScopeServices.createPreferJavaRuntimeVariant(DependencyManagementGlobalScopeServices.java:131)
I tried cleaning, rebuilding the project, tried Invalidate Caches/Restart as well. I also updated the Gradle dependency to the latest one but I couldn't succeed to solve the issue. I really appreciated it if someone could help me regarding the issue.
-
How to add values automatically by button
hello I am making app when I have to set some values and I have two buttons. First is a "-" button and second is "+" button. I add a value every five by clicking a button each time "5,10,15 ... 55" and I would like to hold this button and after for example 1 seconds of holding value will add automatically by holding no clicking. Below I am pasting the code which is responsible for addition and subtraction
public void odejmowanie3(View view) { if (czasprzerwy>=5){ czasprzerwy=czasprzerwy-5; display3(czasprzerwy); } } public void dodawanie1(View view) { iloscrund=iloscrund+1; display(iloscrund); }
-
How to Handel up to 500 mb text data in android and ios application
I have two questions.(soory for my english is not good)
(1)I am working on a books reading application on android and ios in our native language(not english data). i have large amount of raw static text data up to 500 mb application not used internet.i am researching alot on googel which technique is best to handel this data. (1) convert the text data into json form parse the file and display the data. (2) convert the text data in to xml file and parse the file.
or any other format is best in this situation?
(2)Second question is that wheres the put all the data in android studio and xcode?
in android app bundel not support up to 150 mb size what can i do in this situation?
please help me any one above Situation?
-
videoView shows only stopped movie
I made a fragment with following code:
class play_video : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_play_video) val vidView = findViewById<VideoView>(R.id.videoView) val vidController = MediaController(this) val viduri = Uri.parse("android.resource://"+packageName+"/"+R.raw.test1) vidView.setVideoURI(viduri) vidView.start() }
}
It shows the first frame of video and plays sound, but the video was not played and it only shows stopped image.
Is there anything I did wrong ?
The file name of the movie file is 'test1.MOV'
-
Serialize value-types without creating additional fields for 'value' in the database
With firestore it's possible to use
(data) class(es)
data class Address(var person: Person = Person("", "")) data class Person(var firstName: String = "", var lastName: String = "")
that will be serialized into their properties like that
document: person: firstName: "John" lastName: "Doe"
However, I'd like to have a value-type for
firstName
like this one:data class FirstName(var value: String = "") { init { // check value etc. } }
but when I use it for the
firstName
in its default form, it'll serialize intodocument: person: firstName: value: "John" lastName: "Doe"
In order to de/serialize it, I use the standard mechanism like:
// Serialize/write firestore .collection("path") .document() .set(address) // Deserialize/read e.g. firestore .collection("path") .whereEqualTo("person.firstName", "John") .get() .await() .toObjects(Address::class.java)
How can I make it serialize into and deserialize from a string so that the
value
field is not created? -
Where is set java permission in Teamcity?
When I try with Kotlin DSL to execute the file or make an HTTP request, I get such errors:
java.security.AccessControlContext [472]: java.security.AccessControlException: access denied ("java.net.SocketPermission" "my.url:port" "connect,resolve")
or
java.security.AccessControlContext [472]: java.security.AccessControlException: access denied ("java.io.FilePermission" "<<ALL FILES>>" "execute")
On my TeamCity server I made changes in java.policy by adding the value in grant section:
permission java.security.AllPermission;
But it didn't no effect.
-
Python unicode translation leaves input unchanged
I have written a python code that is supposed to translate/transliterate Persian characters. Here is a chunk of the translation table:
dictionary = { '\u062B': 's̱', '\u062C': 'ǧ', }
'\u062B' is "ث" which should be translated to "s̱"
but when I run the following:
string = ('\u062B') print("Original string:", string) string = ('\u062B') print("Translated string:", string.translate(dictionary))
My original string and Translated string are the same:
Original string: ث Translated string: ث
So the translation doesn't occur. What am I doing wrong?
-
How to transliterate into chinese with icu?
I developed a really basic transliterator in java with the icu library. It is working fine for most cases. as transliterationRule I tried e.g "Any-Latin", "Any-Cyrillic", "Any-Arabic", "Any-Greek". Those are working fine. But I really can't figure out how to transliterate into Chinese charakters.
I research a lot but none of the suggestions work. I tried "Any-Hant", "Any-Chinese", "Any-zh_Hans". Is there somebody who knows what language code I can use? I'm quite new to ICU / CLDR
Here is my code:
import com.ibm.icu.text.Transliterator; public class Transliteration { private final String input ; private final String transliterationRule; public Transliteration(String input, String transliterationRule) { this.input = input; this.transliterationRule = transliterationRule; } public String getTransliteration(){ Transliterator transliterator = Transliterator.getInstance(this.transliterationRule); return transliterator.transliterate(this.input); } public String getInput(){ return input; } public String getTransliterationRule(){ return transliterationRule; }
Thank you!
-
PHP Is it faster to transliterate letters or words?
I made a WordPress transliteration plugin that works perfectly but I want to provide maximum optimization of the whole system.
To replace the letters I use
str_replace()
orstrtr()
functions.What bothers me is the load time on the big websites.
The idea I have is that instead of spelling each letter in the very long string, I take and break the words into an array, make unique index of it, transliterate that unique words and replace in the text.
This complicates my algorithm more, but I wonder if it will affect large amounts of data to speed up the transliteration process?
I have not found any more serious research on this and I would like to consult with people who may have had experience.