Hello guys i have started project that i want to translate text from Latin to Cyrillic so i have just this and i dont know how to continue any help will be appreciated
- Thanks :)

private void TranslateActionPerformed(java.awt.event.ActionEvent evt) { 

        String TextToTranslate = textToTranslate.getText();
        char[] latinica = {
            'a',
            'b',
            'v'
        };
        char[] kirilica = {
            'а',
            'б',
            'в'
        };
        for (int l = 0; l < latinica.length; l++) {
            char la = latinica[l];
        }
}

Recommended Answers

All 4 Replies

don't really understand what you're trying to do here. especially since you can't translate words letter by letter.

for instance:

fire
brand (the dutch word for fire)
feuer (the german word for fire)
incendie (the french word for fire)

this should show you two reasons why it wouldn't work:

1 the words are not the same length

fire
ince

as you can see: less than a total translation

2 just because one language has different letters, doesn't mean the other does

fire
feue

so, in this word, both i and e are 'translated' by e, but that's just for this particular word (and, again, the length isn't equal)

Do you really mean "translate"? - in which case see stultuske's post
Or do you mean "transliterate" - replace each letter by it's nearest cyrillic equivalent regardless of meaning, in which case you could use something like this pseudo-code:

for each letter in the original string
   find that letter in the latinica array, remember its index
   get the  letter from the kirilica array at that same index
   append that letter to the output string

(There are other ways to approach this - eg use the input character's numeric value as an index into a single array of cyrillic equivalents, or create a Map with latin letters as keys and cyrillic letters as the values, but your approach is OK)

naah i dont want to use that translation cause its bugged ... :/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.