Hello, I wonder if there is some way so I can make the entire translation project for my language (“Portuguese”), some form of change some .properties or .xml file eg
CUBA Studio doesn’t provide localization tool for an entire project. However, we have developed a separate tool to localize CUBA applications, see attached.
First, the tool reads the project folder and analyzes all message*.properties and export all those into single xls file. Then you add the desired column for a new language (pt in your case) containing translations. Since translation is over you simply perform “write” command.
How to execute
read sourceDir outputFile scanLanguages
write sourceDir lcFile logFile scanLanguages
sourceDir is your local folder where the project is stored
outputFile is xls file that will contain all the lines to be localized
scanLanguages is a sequence of languages you want to process (e.g. “en,pt,ru”)
lcFile is a file with the existing localization. Translations from this file will be added to your project.
logFile is a file containing situations when Localizer needs to merge values or any other ambiguity occurs. In this case you’ll need to work out the correct resolution manually.
read D:\work\MyProject D:\localizationStrings.xls "en,fr" write D:\localizationStrings.xls D:\work\MyProject "fr,pt"
But for example it does not search the standard screens to effect change in fields such as user registration, groups, permissions, roles
Messages used in the platform screens can be localized by creating additional messages files in the same packages that are used in the platform. For example, the Users browser screen uses the messages from the com.haulmont.cuba.gui.app.security.user.browse package. Create this package in your project, add messages_pt.properties file to it, copy messages from the messages.properties file located in the same path inside cuba-gui-x.y.z.jar and rewrite them in Portuguese.
The messages used by the Filter component are located in the com.haulmont.cuba.gui.components.filter. You can localize them in the same way as the platform screens’ messages.
Many common messages (like OK and Cancel actions, etc.) are defined in the main message pack. To localize them you should create messages_pt.properties file in the package specified by the cuba.mainMessagePack application property. Look at the com/haulmont/cuba/gui/messages.properties inside cuba-gui-x.y.z.jar and copy relevant keys from there to your main messages pack in Portuguese.
I’ve attached the demo project which has partial localization (sorry for Google translation).
We can also generate a set of Excel files with all messages from the platform. If you could translate them into Portuguese, we would add them to the platform and make available by default with the next platform release.
Many thanks for the tips, and I’m interested rather in making translations for the files in excel.
Great! We will prepare the files next week and send to you.
We have prepared the set of XLS files with all platform messages - see attached loc_files.zip. They correspond to the platform base projects: cuba, reports, fts, etc. File platform_cuba.xls contains “pt” column with messages in uppercase which we added for testing. You can translate this column in Portuguese.
To create message_pt.properties in your project, download attached localizer-0.1-22092015-1543.zip, unpack it, open console in bin folder and run:
> localizer --write --sourceDir=<your project root> --lcFile=<xls file, for example platform_cuba.xls> --logFile=log.xls --scanLanguages="pt"
After that, a user logged in with “pt” language will see all messages from the generated files.
We would appreciate if you send us back the translation so we could provide it to other developers - most probably as part of a repository of third-party localizations.
Good morning, I’m checking the excel and so complete will be sending, thank you for now
Good afternoon, I tried to make imports for testing but the informed command failed, could better detail how to import xls files? grateful.
What was the command output?
since i have the same problem with the german translation, i thought of translating it myself with this tool. Unfortunately it only worked once. After that i usually get
$ i18n/localizer-0.1-22092015-1543/bin/localizer --write --sourceDir=. --lcFile=i18n/loc_files/platform_cuba.xls --scanLanguages="de" java.lang.IllegalStateException: Cannot get a text value from a numeric formula cell at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:643) at org.apache.poi.hssf.usermodel.HSSFCell.checkFormulaCachedValueType(HSSFCell.java:648) at org.apache.poi.hssf.usermodel.HSSFCell.getRichStringCellValue(HSSFCell.java:725) at org.apache.poi.hssf.usermodel.HSSFCell.getStringCellValue(HSSFCell.java:703) at com.haulmont.taxi.tools.localizer.helper.XlsHelper.getCellValue(XlsHelper.java:36) at com.haulmont.taxi.tools.localizer.object.LocalizationsBatch.readLocalizationFile(LocalizationsBatch.java:100) at com.haulmont.taxi.tools.localizer.object.LocalizationsBatch.<init>(LocalizationsBatch.java:43) at com.haulmont.taxi.tools.localizer.MessagePropertiesProcessor.main(MessagePropertiesProcessor.java:41)
Because of this, i formatted every cell in the excel file as “text” - but it does not seem to have an impact (see attached file - which is not quite ready yet).
Other times i get a Nullpointer Exception when using the command line tool.
Could you take a look at it? That would be great, since it is a pretty nead way of translating the stuff (although it is a pretty amount of work, that i had not thought of :))
To avoid NPE add logFile parameter to the localizer call (see in bold)
$ i18n/localizer-0.1-22092015-1543/bin/localizer --write --sourceDir=. --lcFile=i18n/loc_files/platform_cuba.xls --scanLanguages=“de” –logFile=log.xls
Thank you for detecting a problem. The exception is caused by “pt” column, which is formed as UPPER© formula. So, in your case, just remove entire D column, as long as you obviously don’t need it (see attached), and try again. Should work.
thanks - this way it worked.
I’ll post the results when i’m ready.
Bug with formulas has been fixed, new version attached.
Good morning, still showing the same mistake, following image
Seems you have a typo in localization file definition. It should be lcFile, starts with l (L in lower case), and not I (i in upper case).
We will handle this case in the following version.
Thanks for the help but now this returning this other error
Please, try attached file, should work. I changed format of the pt column, it’s all text now.
Hello, I can import the file, but now I’m getting the following difficulty.I need to correct some translation errors but when I care again he is not applying the changes, fixes so when I do the exclusion of the project and create again. how can I proceed?
after translating the xls file (just platform_cuba.xls) and adding it sucessfully to the test project, it turns out that different text snippets are not being translated. Im not sure, why this happens. Due to this, i added the sample project. In the root directory there is a folder “i18n” which includes the excel files as well as some images, that show the not translated parts called “error-translation-images”.
If you could take a look into it, that would be great.
At least for the “filter-save-as-search-folder.png” i found out, that in the excel sheet the parameter names are prefixed with a “#” like the following: “#FilterEditor.cancelBtn”. Is there any reason for this?