Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language support #4

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Language support #4

merged 2 commits into from
Oct 24, 2024

Conversation

lubitchv
Copy link
Collaborator

Language support was added. The code is checking xml:lang (Metadatalanguage) property in xml codebook and if it is present, it selects the language for pdf codebook based on it. If inc language file does not exists than it produces English pdf codebook.
If property xml:lang does not exist then code tries to guess the language of dataset based on Title or Description. It uses Apache Tika language detection. If it detects language with high probability then this language is used for generating pdf codebook, in all other cases English is used.

Copy link
Member

@qqmyers qqmyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I had a couple questions and an offline request to bump the version number.

String url =href.substring("file:".length()); // some calculation from its parameters
InputStream is = this.getClass().getResourceAsStream(url);
return new StreamSource(is);
int index = href.lastIndexOf("/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the path? I guess it works now because the java package path and the resources path are the same?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and also It did not work with the path. In any case "ddi-to-fo.xsl" also does not use path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird - I thought I had the i18n part (without the tika test) working at one point.

<groupId>org.apache.tika</groupId>
<artifactId>tika-langdetect-optimaize</artifactId>
<version>2.9.2</version>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you looked at issue #3 - is fop still not included? Are the tika classes? (If so - then we can close that issue when this merges).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fop is included. I did not have problems with it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - guessing it's a build command problem - I made a note in the issue #3.

@lubitchv
Copy link
Collaborator Author

I changed version to 1.1.0

@pdurbin
Copy link
Member

pdurbin commented Oct 24, 2024

Can we publish it to Maven Central? And update the TBD at https://github.com/gdcc/dataverse-exporters ?

@qqmyers
Copy link
Member

qqmyers commented Oct 24, 2024

I was able to test this in English and it worked fine, so I'll go ahead and merge.

@qqmyers qqmyers merged commit 48cf697 into gdcc:main Oct 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants