Some general utility classes.
- - diff --git a/src/main/java/w2phtml/util/Transliteration.java b/src/main/java/w2phtml/util/Transliteration.java new file mode 100644 index 0000000..8137401 --- /dev/null +++ b/src/main/java/w2phtml/util/Transliteration.java @@ -0,0 +1,41 @@ +package w2phtml.util; + +public class Transliteration { + + public static String transliterateToEn(String fileName) { + return fileName + .replaceAll("[аА]", "a") + .replaceAll("[бБ]", "b") + .replaceAll("[вВ]", "v") + .replaceAll("[гГ]", "g") + .replaceAll("[дД]", "d") + .replaceAll("[еЕ]", "e") + .replaceAll("[ёЁ]", "e") + .replaceAll("[жЖ]", "zh") + .replaceAll("[зЗ]", "z") + .replaceAll("[иИ]", "i") + .replaceAll("[йЙ]", "y") + .replaceAll("[кК]", "k") + .replaceAll("[лЛ]", "l") + .replaceAll("[мМ]", "m") + .replaceAll("[нН]", "n") + .replaceAll("[оО]", "o") + .replaceAll("[пП]", "p") + .replaceAll("[рР]", "r") + .replaceAll("[сС]", "s") + .replaceAll("[тТ]", "t") + .replaceAll("[уУ]", "u") + .replaceAll("[фФ]", "f") + .replaceAll("[хХ]", "kh") + .replaceAll("[цЦ]", "ts") + .replaceAll("[чЧ]", "ch") + .replaceAll("[шШ]", "sh") + .replaceAll("[щЩ]", "sch") + .replaceAll("[ъЪ]", "") + .replaceAll("[ыЫ]", "y") + .replaceAll("[ьЬ]", "") + .replaceAll("[эЭ]", "e") + .replaceAll("[юЮ]", "yu") + .replaceAll("[яЯ]", "ya"); + } +}