grails internationalization: a strange behaviour - grails

I'm using grails for my project and I'm facing a little trouble.
I have an Internationalization system and I use messages.properties files to list all strings that needs to be internationalized.
I've created one as follows:
<g:message code='logged.in.as'/>
in my messages.properties file I have the following:
logged.in.as=Logged in as\:
but, when I load the browser, I see the following
logged.in.as
Why this strange behaviour?Notice that I use the <g:message> tag for a lot of other strings and everything works well...

Related

How to upload a file in Grails 3

Grails 2 had a plugin for that, there also used to be
request.getFile
method. There is no method like this in Grails 3 as far as I can see, or a plugin.
I tried using
request.getInputStream
But this one is always empty. Other thing I tried was by using Spring-boot way of handling Uploads, but this one relies on
#RequestParam("file") MultipartFile file
It cannot be used in Grails, controllers there do not allow parameters to be defined this way AFAIK.
How to upload files in Grails 3?
Actually there is
request.getFile(fileName)
in Grails 3 as well. It was just not displayed in autofill in my IDE for some reason (the rest of the request methods like getParameters or isPost are displayed correctly).

Generating dynamic forms with grails

Using Grails 2.3.5 and try to make a dynamic form like described in link below:
http://omarello.com/2010/08/grails-one-to-many-dynamic-forms/
But when access the create, none phone field are shown.
I've copied exactly like the example. I don't know if there are some kind of conflicts with the javascript or something else.

Warning messages in GSP: "unknown tag"

I am having bunch of warning messages for "g:" | "asset:" etc, in my GSP files. Also, the content assist is not working in the editor. But if I manually type the code, the file executes properly while running in server. But it is very tedious to code without the content assist for the grails taglib elements and also warning messages are annoying.
Ex Warning in editor: "Unknown Tag (asset:image)"
My configuration is as below:
1. Grails 2.4.0
2. GGTS 3.6.2
I have the grails.tld, with all the grails tags mentioned in the tld, in webapp/web-inf/tld folder but seems GGTS is not able to recognize the tld. I read in various similar questions that we do not have to explicitly specify the taglibs at the top of each GSP page.
Need suggestions on what can be done to resolve the warnings and make the content assist work properly in the editor.

localization bangla language in grails application in gsp page using properties file

I need to use localization in my grails application. In my application there will be used two languages. one is English and another one is Bangla. For this, I have installed my desired Bangla font in my pc.
For all other languages it is working fine but in case of Bangla text my gsp page is showing question marks(????).
Note that i have created a new property file named messages_bn.properties for bangla text to get value from the file into my gsp page. What am i missing?
Thanks.
just encode the file as utf-8. From Intellij I have done following >>

Images Not Showing in MVC

I am working on MVC4 project and facing a problem.The project on which i am working was developed in web forms.The html of pages is already saved in Database.I am getting this html from DB and showing it on Views. Now the problem is that this Html aslo contains Images and links and these are working fine in web forms application but in MVC images and links are not working i.e images fail to load due to invalid path although i have made the same folder structure. Here is an example.
Suppose i have an image in folder App_Themes/Theme1/Img/download_icon.gif. Now in MVC project if i give this image the src like /App_Themes/Theme1/Img/download_icon.gif it is loaded correctly but if i give it the src like App_Themes/Theme1/Img/download_icon.gif it does not load and this is saved in Db. My question is how can i load all images correctly that come from Db in html?
You got a tricky scenario. Its always a bad practice to keep Html tags in database because it may cause these kind of issues in future, which gives head aches to current developer working on that. As per my opinion there is no solution, but I am suggesting a work around for you to overcome this. This is an issue with virtual directory and hope that we can resloved by Url.content.
Any way your are getting the html from database. So I believe that you have something similar to this.
string htmlContent = getHtmlforPage1()
it will returns you all the html for page one and you use HtmlString() to show it in your view.
You can replace the <img src=blah\blah.img /> with "<img src="+ Url.Content(blah\blah.img") />. all you need is to write down a function to achieve this.
This question will gives you about the need for url.content()
why use #Url.Content
If possible please change avoid storing html in database

Resources