Tapestry 5.4 core.properties override - java

I have a tapestry 5.4 project, and I want to override one element of the default core.properties file.
I tried to add to login_en.properties and login_hu.properties a new line (core-default-error-banner=...) but it do not override it.
Is there any way to overwrite it?
Thanks for the answers in advance.

If you intend to overwrite the header line of the Errors component, just specify your own message id in the page/component template like this:
<t:errors banner="message:your-translated-error-msg-id" />

To support other locales, just translate the built-in message catalog (property) files yourself: To have Tapestry use these new files, just put them in the corresponding package-named directory within your own app (for example, src/main/resources/org/apache/tapestry5/core.properties). More informtation can be found from Tapestry site.

Related

Protobuffers to XML

I want to convert my google protocol object to XML format. In that I would like to keep some fields as attribute.
Instead of :
<field>
<name>ApiFieldHeaderName</name>
<maxLength>50</maxLength>
</field>
I want following :
<field name="ApiFieldHeaderName" maxLength="50" ></field>
My protocol is
string name = 1;
int32 maxLength = 2;
And then I have gone through some forum and used xml_disposition
[(xml_disposition) = ATTRIBUTE]
However, I am getting the error:
Option "(xml_disposition)" unknown.
I am using proto3 and language is Java.
syntax = "proto3";
option optimize_for = SPEED;
I believe you've found xml_disposition from a side discussion on the protobuf newsgroup from 2009. The option mentioned, however, was purely hypothetical. As far as I know: no such xml_disposition custom option exists - and least, not as a standard option - and no code-generator looks for it. No mention of xml_disposition exists in the Google protobuf source, and the current version of protoc (3.5.1) does not recognise it and an inbuilt option.
So:
yes, it is possible to add custom extensions in .proto that you can annotate fields (etc) with
yes, you can write your own codegen tools to check for those custom options and emit additional generated code to implement what you want
but none of this ships by default
Side note: custom options must be defined in "proto2" syntax files, but a "proto3" file can still import and use those custom options from the "proto2" file.

MessageSource equivalent in Django?

I come from a Java/Spring background and I've just recently moved to Python/Django. I'm working on a new project from scratch with Django. I was wondering how Django handles common String messages. Is there one single common file that can be called in a resources folder? For example, in Spring, we have a MessageSource is a key/value pair properties file that is global to most of the app. Is there something similar in Django? If so, how does it work for the normal app side and the unit tests side?
You could take a look over Django's messages framework.
Also, you can use key-value pairs in Python, with dicts:
# Upper case because it is constant
LOGIN_ERRROS = {
'login_error_message': 'message here',
...
}
You could put this in a file, you can even name it message_source.py, inside you app and import it when you need it:
For example, in your view:
# views.py
...
from myapp.message_source import LOGIN_ERRORS
Django uses the standard gettext + .po files for internationalization/translation. Check out the Translation docs for all the steps needed: https://docs.djangoproject.com/en/1.9/topics/i18n/translation/

Thymeleaf add custom data attribute with message resource value

I have a requirement where I need to insert the value to custom data tag using thymeleaf. The code for doing it using
data-th-attr="${data-custom=#messages.msg('test')}"
as well as
th:attr="data-custom=${#messages.msg('test')}"
I am unable to get the value in both the cases.
ultimately the parsing should be like data-custom="test"
here test is key for the value test in a properties file
By using the
data-th-attr="data-custom=#{test}"
or By using
th:attr="data-custom=#{test}"
helped me out, here test is the key for the value in message resource the issue was with the intellij IDEA IDE, it was having a bug that was showing me an unnecessary error.
Use th:attr="data-custom=#{key.for.message}" , this should work.
then after parsing the Expression,
data-custom="value.for.message"

How to set sdtc:valueset attribute to a code or value tag in the xml using java

I am trying to generate QRDA1 using MDHT model and have stuck up with the setting of the sdtc:valueset attribute to a code or value tag. The QRDA spec example below shows sdtc:valueset:
CE code = DatatypesFactory.eINSTANCE.createCE();
code.setCode("247472004");
code.setDisplayName("Hives");
code.setCodeSystem("2.16.840.1.113883.6.96");
code.setCodeSystemName("SNOMED CT");
these tags are present in MDHT library but
code.setValueSet("{$QDMElementValueSetOID}");
is not present in mdht model.
How can I solve this problem?
the updated Runtime jars which contains the sdtc:value attribute for code and values set are located at the below link
http://sourceforge.net/projects/oht-modeling/files/Releases/
open the link and click on the Runtime which contains the updated jars files.

NullPointer getting internationalization text at LocalizedTextUtil

I have 3 language files idioma_CA.properties idioma_EN.properties idioma_ES.properties in the package "idiomas" and one default idioma.properties.
struts.properties has this properties:
hibernatePlugin.configurationType=annotation
struts.custom.i18n.resources = idiomas/idioma
So everytime I try to change the language struts2 ignores me and get always the text from the default properties at JSP's.
But using "getText" at execute method of my Action I get that NullPointerException whatever locale i have at request_locale.
Can someone tell me what am i doing wrong?
Thank you very much
I solved the problem.
The localization letters after "idioma_" must be lowercase like "idioma_ca.properties"

Categories