The Dataverse Software provides and API endpoint for adding languages using a zip file.
First, clone the “dataverse-language-packs” git repo.
git clone https://github.com/GlobalDataverseCommunityConsortium/dataverse-language-packs.git
Take a look at https://github.com/GlobalDataverseCommunityConsortium/dataverse-language-packs/branches to see if the version of the Dataverse Software you’re running has translations.
Change to the directory for the git repo you just cloned.
cd dataverse-language-packs
Switch (git checkout) to the branch based on the Dataverse Software version you are running. The branch “dataverse-v4.13” is used in the example below.
export BRANCH_NAME=dataverse-v5.5
git checkout $BRANCH_NAME
Create a “languages” directory in “/tmp”.
mkdir /tmp/languages
Copy the properties files into the “languages” directory
cp -R en_US/*.properties /tmp/languages
cd /tmp/languages
zip languages.zip *.properties
Load the languages.zip file into your Dataverse Installation
Now that you have a “languages.zip” file, you can load it into your Dataverse installation with the command below.
curl http://localhost:8080/api/admin/datasetfield/loadpropertyfiles -X POST --upload-file /tmp/languages/languages.zip -H "Content-Type: application/zip"
Click on the languages using the drop down in the header to try them out.
As I didn't find the same procedure for the Portuguese language in the dataverse version 5.5, I tried to use the version 4.13.
But when I ran the same procedure for Portuguese, at the time I ran the command. My dataverse doesn't open anymore.
Could you help me on how to reverse this? Or how to solve?
The error log is attached.
FWIW:
The loadpropertyfiles api call unzips your files and writes it to the Dataverse lang directory (set via the dataverse.lang.directory property, /tmp/languages by default).
The error in the log indicates that Dataverse can’t find the properties files for English (en), which appears to be fatal. From looking in the code, I think creating/adding files to the languages dir makes Dataverse look for an en file rather than using the builtin Bundle.properties file.
So – just to restore, I think if you remove files from the Dataverse.lang.directory dir you should be able to boot. To run with Portuguese, you should make sure you have en files in your zip/ in the lang directory as well.
In general, the problem with older language bundles is that they are missing entries added in later versions and you’ll see odd labels in the UI for those new fields. So, it probably would work for testing, but I think you’d want to update the language pack before thinking about production (manually or using weblate.dataverse.org).
Hope that helps,
--Jim
--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
dataverse-commu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/dataverse-community/9e230e24-456a-4413-8751-731cb68bb825n%40googlegroups.com.
Leonard,
I haven’t gotten to look through everything but I have one quick thought from image2: the code may expect the en_US and pt_BR directly under /home/Dataverse/langBundles rather than in a Dataverse-language-packs subdir. That could be due to your zip including that parent dir when it shouldn’t, but I think you could try manually moving the subdirs up on directory level.
-- Jim
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/07c68854-5b50-48c4-b836-c42bccb4d0c8n%40googlegroups.com.
Leonard,
I looked again and did some testing:
Whatever you have for your language dir setting, e.g. /tmp/languages, you have to have all of the properties files in that dir with no subdirs.
The config guide instructions say:
cp -R en_US/*.properties /tmp/languages
…
And then
cd /tmp/languages
zip languages.zip *.properties
which should give you a flat set of files in /tmp/languages when you unzip there.
W.r.t. to testing: when I set my Dataverse.lang.directory jvm-option to a directory that didn’t exist, I got 500 errors. When I created the dir and then added Bundle.properties from the us_en pack, I was able to get to the homepage.
So – I think if you remove the subdirectory structure in what you did, you should be up and running.
Then – I would suggest some dir outside of /tmp for your real data.lang.directory (some filesystems periodically delete everything in /tmp!) and you’ll then be in a position to look into updating the older pt pack to add missing terms (e.g. with Weblate).
Hope that helps!
-- Jim
From: dataverse...@googlegroups.com [mailto:dataverse...@googlegroups.com] On Behalf Of leonardr...@gmail.com
Sent: Wednesday, July 21, 2021 1:57 PM
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/07c68854-5b50-48c4-b836-c42bccb4d0c8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/MN2PR07MB7343C103C20F64E57822AD15BFE59%40MN2PR07MB7343.namprd07.prod.outlook.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/CAP3T2bPFv%2BNOdBmjq7UPqjk2rDLckiBY9KQMnLFyd-XfwXAoBA%40mail.gmail.com.
Leonard,
Sorry for the delay. If you haven’t figured this out yet:
I was able to display pt_BR translations with the following:
· Using “locale”:”pt_BR” in the :Languages setting
· Using files with names like Bundle_pt_BR.properties in the /home/dataverse/langBundles directory.
-- Jim
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/CAP3T2bPFv%2BNOdBmjq7UPqjk2rDLckiBY9KQMnLFyd-XfwXAoBA%40mail.gmail.com.