Adding Okapi OpenXML feature to support more file types - "Cannot find symbol" Error when build project
Description
Environment
Attachments
- 25 Nov 2016, 07:55 pm
- 25 Nov 2016, 07:54 pm
- 25 Nov 2016, 07:54 pm
Activity
Carlos Munoz 4 December 2016 at 12:37
Erred case
1. Go to `api` directory. Package it.
2. Go to `server` directory. Package it.
=> Yields error, because changes in `api` is not detected (symbol is not there)
If you just package it, I believe maven won't make it available for subsequent runs. You might need to run
mvn install
for this to work. Alternatively, you could package the individual modules and they will be available in the reactor. Something like:
mvn package -pl api, server
This way you are building the specific modules you need. Hope this helps.
Former user 30 November 2016 at 21:40
@Oytun Tez
Just one question: is there significant difference between File project type and others? Is it solely for making a proper directory structure for those non-File project types? E.g, putting translations by creating new files such as `app.en.xliff`, `app.fr.xliff`, `fr/strings.po`? Some clarification would help a lot. It looks like we won't currently need non-File project types, as our main system handles those kind of manipulations.
Yes, file project type is using implementation of Okapi filter library. It has no predefined directory structure like gettext/podir, and maintainer needs to control those by using src-dir, trans-dir, includes, excludes, and file-mapping-rule.
For our changes in zanata-common-api to be seen in zanata-server, we had to compile the whole application. Compiling only zanata-common-api and then zanata-server did not help with this.
Are we doing something wrong?
The steps you listed is correct. If you use maven to compile, it should pick up the latest artifacts from your local .m2 directory (which will then have your changes). Another thing you can try after compile api, is to do compile server and `clean` option. But packaging whole zanata-platform should not increase the build time signifacantly.
Let me know if you still have issue.
Oytun Tez 30 November 2016 at 18:22
By the way, one weird workflow (or our ignorance):
For our changes in zanata-common-api to be seen in zanata-server, we had to compile the whole application. Compiling only zanata-common-api and then zanata-server did not help with this.
Are we doing something wrong?
Steps:
*Erred case*
1. Go to `api` directory. Package it.
2. Go to `server` directory. Package it.
=> Yields error, because changes in `api` is not detected (symbol is not there)
*Success case*
1. Go to root directory (in platform repo). Package everything.
=> `api` and `server` is now packaged with our changes, `server` is not complaining. (symbol is there)
Oytun Tez 30 November 2016 at 18:18
Hi Alex,
Yes, we will send a PR for this feature. We are enabling several other formats. Let us finalize this feature branch in a couple days.
Just one question: is there significant difference between File project type and others? Is it solely for making a proper directory structure for those non-File project types? E.g, putting translations by creating new files such as `app.en.xliff`, `app.fr.xliff`, `fr/strings.po`? Some clarification would help a lot. It looks like we won't currently need non-File project types, as our main system handles those kind of manipulations.
Best,
Oytun
Former user 29 November 2016 at 23:27
@haiwei.su@motaword.com This feature seems alright to be merge into Zanata project. If I may suggest, please feel free to create a patch (pull request) for the project. We are happy to merge this in.
Details
Details
Assignee
Reporter
Tested Version/s
Affects versions
Priority

Hello,
I was trying to adding more supported file types for Zanata. In particular, I'd like Zanata to support MS Office file types. When I imported OpenXML from Okapi and did the exactly the same feature config steps. When I tried to build the project, it kept telling me the program "cannot find the symbol: MS_OFFICE_WORD, MS_OFFICE_POWERPOINT, MS_OFFICE_EXCEL".
public enum DocumentType { GETTEXT(buildPotMap()), PLAIN_TEXT("txt"), XML_DOCUMENT_TYPE_DEFINITION("dtd"), OPEN_DOCUMENT_TEXT("odt"), OPEN_DOCUMENT_TEXT_FLAT("fodt"), OPEN_DOCUMENT_PRESENTATION("odp"), OPEN_DOCUMENT_PRESENTATION_FLAT("fodp"), OPEN_DOCUMENT_SPREADSHEET("ods"), OPEN_DOCUMENT_SPREADSHEET_FLAT("fods"), OPEN_DOCUMENT_GRAPHICS("odg"), OPEN_DOCUMENT_GRAPHICS_FLAT("fodg"), OPEN_DOCUMENT_DATABASE("odb"), OPEN_DOCUMENT_FORMULA("odf"), MS_OFFICE_EXCEL("xslx"), MS_OFFICE_POWERPOINT("pptx"), MS_OFFICE_WORD("docx") }
This the code I added in DocumentType.java file.
And also I put them into DOCTYPEMAP in TranslationFileServiceImpl.java file as well:
public class TranslationFileServiceImpl implements TranslationFileService { private static Map<DocumentType, Class<? extends FileFormatAdapter>> DOCTYPEMAP = new MapMaker().makeMap(); private static DocumentType[] ODF_TYPES = { OPEN_DOCUMENT_TEXT, OPEN_DOCUMENT_PRESENTATION, OPEN_DOCUMENT_SPREADSHEET, OPEN_DOCUMENT_GRAPHICS }; static { for (DocumentType type : ODF_TYPES) { DOCTYPEMAP.put(type, OpenOfficeAdapter.class); } DOCTYPEMAP.put(MS_OFFICE_EXCEL, OpenXMLAdapter.class); DOCTYPEMAP.put(MS_OFFICE_POWERPOINT, OpenXMLAdapter.class); DOCTYPEMAP.put(MS_OFFICE_WORD, OpenXMLAdapter.class); DOCTYPEMAP.put(PLAIN_TEXT, PlainTextAdapter.class); DOCTYPEMAP.put(XML_DOCUMENT_TYPE_DEFINITION, DTDAdapter.class); DOCTYPEMAP.put(IDML, IDMLAdapter.class); DOCTYPEMAP.put(HTML, HTMLAdapter.class); DOCTYPEMAP.put(JSON, JsonAdapter.class); DOCTYPEMAP.put(SUBTITLE, SubtitleAdapter.class); DOCTYPEMAP.put(PROPERTIES, PropertiesLatinOneAdapter.class); DOCTYPEMAP.put(PROPERTIES_UTF8, PropertiesUTF8Adapter.class); DOCTYPEMAP.put(XLIFF, XliffAdapter.class); DOCTYPEMAP.put(GETTEXT, GettextAdapter.class); DOCTYPEMAP.put(TS, TSAdapter.class); }
I also added these types in ProjectType.java file :
public static List<DocumentType> fileProjectSourceDocTypes() { return Arrays.asList(XML_DOCUMENT_TYPE_DEFINITION, PLAIN_TEXT, IDML, HTML, OPEN_DOCUMENT_TEXT, OPEN_DOCUMENT_PRESENTATION, OPEN_DOCUMENT_GRAPHICS, OPEN_DOCUMENT_SPREADSHEET, MS_OFFICE_EXCEL, MS_OFFICE_POWERPOINT, MS_OFFICE_WORD, SUBTITLE, GETTEXT, PROPERTIES, PROPERTIES_UTF8, XLIFF, TS, JSON); }
After all these modifications, it still prompt the error message saying "cannot find symbol MS_OFFICE_WORD, MS_OFFICE_EXCEL, MS_OFFICE_POWERPOINT".
Can someone tell me where I did wrong or which file I should look into?
Thanks,
Haiwei