diff --git a/OsmAnd/assets/voice/sk-tts/ttsconfig.p b/OsmAnd/assets/voice/sk-tts/ttsconfig.p index f9015ed34d..9bf2fcdf19 100644 --- a/OsmAnd/assets/voice/sk-tts/ttsconfig.p +++ b/OsmAnd/assets/voice/sk-tts/ttsconfig.p @@ -40,8 +40,8 @@ go_ahead == ['pokračujte rovno']. go_ahead(Dist) == ['pokračujte ', D]:- distance(Dist) == D. and_arrive_destination == ['a dorazíte do cieľa']. -and_arrive_intermediate == ['and arrive at your via point ']. -reached_intermediate == ['you have reached your via point']. +and_arrive_intermediate == ['a dorazíte cez Váš prechodný bod ']. +reached_intermediate == ['dorazili ste k Vášmu prechodnému bodu']. then == ['potom ']. reached_destination == ['dorazili ste do cieľa']. diff --git a/OsmAnd/res/values-sk/strings.xml b/OsmAnd/res/values-sk/strings.xml index 0a299fac7c..78b80de146 100644 --- a/OsmAnd/res/values-sk/strings.xml +++ b/OsmAnd/res/values-sk/strings.xml @@ -1,5 +1,10 @@ + Prechodný bod %1$s je príliš daľeko od najbližšej cesty. + Dorazili ste k Vášmu prechodnému bodu + Pridať prechodný bod + Prechodný bod + Štartovací bod je príliš ďaleko od najbližšej cesty. Parkovanie Pomoc v núdzi Verejná doprava diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java deleted file mode 100644 index 090fa2bd58..0000000000 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/TranslatorMain.java +++ /dev/null @@ -1,5 +0,0 @@ -package net.osmand.translator; - -public class TranslatorMain { - -} diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java index 28bd70ab0d..359471c17a 100644 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java +++ b/build-scripts/net.osmand.translator/src/net/osmand/translator/handlers/TranslationHandler.java @@ -1,5 +1,11 @@ package net.osmand.translator.handlers; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintStream; + import net.osmand.translator.utils.FieldsHandler; import net.osmand.translator.utils.MethodHandler; @@ -10,6 +16,7 @@ import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMethod; @@ -22,45 +29,40 @@ import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jface.text.Document; -//import org.eclipse.jface.text.Document; + public class TranslationHandler { - public static void execute() { - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot root = workspace.getRoot(); - IPath path = root.getProject("DataExtactionOSM").getFile("src/net/osmand/osm/MapUtils.java").getFullPath(); + public static void execute(String inFile, PrintStream out) throws IOException { // parse "MapUtils.java" - // IPath path = Path.fromOSString("/DataExtractionOSM/src/net/osmand/osm/MapUtils.java"); - IFile iFile = root.getFileForLocation(path); - ICompilationUnit unit = (ICompilationUnit) JavaCore.create(iFile); - CompilationUnit parse = parse(unit); - FieldsHandler.printFieldsInfo(parse); - System.out.println(); - MethodHandler.printMethodsInfo(parse); - } - - private static CompilationUnit parse(ICompilationUnit unit) { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setKind(ASTParser.K_COMPILATION_UNIT); - parser.setSource(unit); - parser.setResolveBindings(true); - return (CompilationUnit) parser.createAST(null); // parse - } - - // /////////////////////////////////////////////////////////////////////////// - - private void getProjects(IWorkspaceRoot root) { - IProject[] projects = root.getProjects(); - for (IProject project : projects) { - try { - printProjectInfo(project); - } catch (CoreException e) { - e.printStackTrace(); - } + BufferedReader fr = new BufferedReader(new FileReader(new File(inFile))); + String readLine; + String buf = ""; + while ((readLine = fr.readLine()) != null) { + buf += readLine; } + fr.close(); + CompilationUnit parse = parse(buf); + FieldsHandler.printFieldsInfo(parse, out); + out.println(); + MethodHandler.printMethodsInfo(parse, out); } + private static CompilationUnit parse(String source) { + ASTParser parser = ASTParser.newParser(AST.JLS3); + parser.setResolveBindings(true); +// parser.setCompilerOptions(Options.getCompilerOptions()); + parser.setSource(source.toCharArray()); + parser.setResolveBindings(true); +// parser.setUnitName(name + ".java"); +// parser.setEnvironment(new String[] { getComGoogleDevtoolsJ2objcPath() }, +// new String[] { tempDir.getAbsolutePath() }, null, true); + CompilationUnit unit = (CompilationUnit) parser.createAST(null); +// assertNoCompilationErrors(unit); + return unit; + } + + private void printProjectInfo(IProject project) throws CoreException, JavaModelException { System.out.println("Working in project " + project.getName()); // Check if we have a Java project diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/FieldsHandler.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/FieldsHandler.java index 4363c7807b..9563eef9fa 100644 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/FieldsHandler.java +++ b/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/FieldsHandler.java @@ -1,5 +1,7 @@ package net.osmand.translator.utils; +import java.io.PrintStream; + import net.osmand.translator.visitor.FieldVisitor; import org.eclipse.jdt.core.dom.CompilationUnit; @@ -10,7 +12,7 @@ import org.eclipse.jdt.core.dom.VariableDeclarationFragment; public class FieldsHandler extends AbstractHandler{ - public static void printFieldsInfo(CompilationUnit parse) { + public static void printFieldsInfo(CompilationUnit parse, PrintStream out) { FieldVisitor fVisitor = new FieldVisitor(); parse.accept(fVisitor); for (FieldDeclaration field : fVisitor.getFields()) { @@ -23,6 +25,9 @@ public class FieldsHandler extends AbstractHandler{ // type applyType(field.getType(), buffer); // name + if(binding == null){ + continue; + } buffer.append(binding.getJavaElement().getElementName()); // array brackets if (binding.getType().isArray()) { @@ -34,8 +39,8 @@ public class FieldsHandler extends AbstractHandler{ } // end of string buffer.append(";"); - System.out.println(buffer); -// System.out.println(); + out.println(buffer); +// out.println(); } } diff --git a/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/MethodHandler.java b/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/MethodHandler.java index 84cf770de1..ec97f9ce78 100644 --- a/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/MethodHandler.java +++ b/build-scripts/net.osmand.translator/src/net/osmand/translator/utils/MethodHandler.java @@ -1,5 +1,7 @@ package net.osmand.translator.utils; +import java.io.PrintStream; + import net.osmand.translator.visitor.MethodVisitor; import org.eclipse.jdt.core.dom.Block; @@ -9,7 +11,7 @@ import org.eclipse.jdt.core.dom.Type; public class MethodHandler extends AbstractHandler{ - public static void printMethodsInfo(CompilationUnit parse) { + public static void printMethodsInfo(CompilationUnit parse, PrintStream out) { MethodVisitor mVisitor = new MethodVisitor(); parse.accept(mVisitor); for (MethodDeclaration method : mVisitor.getMethods()) { @@ -29,8 +31,8 @@ public class MethodHandler extends AbstractHandler{ buffer.append("{"); fillBody(method, buffer); buffer.append("}"); - System.out.println(buffer); - System.out.println(); + out.println(buffer); + out.println(); } } @@ -39,9 +41,9 @@ public class MethodHandler extends AbstractHandler{ } private static void fillBody(MethodDeclaration method, StringBuffer buffer) { - Block body = method.getBody(); - System.out.println(body); + Block body = method.getBody(); + buffer.append(body); } private void parseSimpleForStatement() { diff --git a/build-scripts/net.osmand.translator/test/src/net/osmand/translator/test/TranslatorTest.java b/build-scripts/net.osmand.translator/test/src/net/osmand/translator/test/TranslatorTest.java index ff8977ae27..87e5ddb2f7 100644 --- a/build-scripts/net.osmand.translator/test/src/net/osmand/translator/test/TranslatorTest.java +++ b/build-scripts/net.osmand.translator/test/src/net/osmand/translator/test/TranslatorTest.java @@ -1,13 +1,17 @@ package net.osmand.translator.test; +import java.io.File; +import java.io.IOException; + +import net.osmand.translator.handlers.TranslationHandler; + import org.junit.Test; public class TranslatorTest { - @Test - public void simpleTest(){ - + public void simpleTest() throws IOException{ + TranslationHandler.execute(new File("test/resources/MapUtils.java").getAbsolutePath(), System.out); System.out.println("SUCCESS !!!!! "); }