Liferay ignores my portlet's Language.properties - localization

My portlet defines some GUI elements containing text labels "category" and "abbreviation":
[...]
<liferay-ui:search-container-column-text
name="category"
property="category"
/>
<liferay-ui:search-container-column-text
name="abbreviation"
property="abbreviation"
/>
[...]
When rendered in a web browser, "category" shows up as "Category" (probably because the Liferay portal uses that word for its core) which is great, but "abbreviation" stays lowercase, so I created a new file WEB-INF/src/content/Language.properties containing this:
abbreviation=Abbrevation
PROBLEM: Even after rebuilding and restarting the server, "abbreviation" is still shown lowercase. It seems that Liferay does not take into account my portlet's Language.properties.
QUESTION: What could be my problem? What did I forget?

Check in your portlet.xml, inside portlet node you should have this:
<resource-bundle>content.Language</resource-bundle>
If you can't find it we have found your problem probably (one of your problems at least)!
This line tells the portlet in which file search your custom language keys before of the core ones.
Ref: Localizing your Portlet

Related

Eloqua form has `<eloqua />` tags inside input values

Eloqua is generating forms:
http://codepen.io/EightArmsHQ/pen/6dce8530a881a3c5795e822ffefe508b?editors=1000
But the output html looks like this:
<input value="<eloqua type='emailfield' syntax='LastName' />" class="field-size-top-large" />
I assumed that the value attribute was something that was then going to be replaced by some Eloqua JavaScript, but when I view it on the page with JavaScript, sure enough its still there:
How can I remove these tags? Is this a bug with Eloqua?
I managed to remove these. The <eloqua /> tags are inside the value field like that because they are used on Eloqua hosted pages – so for instance if the marketing team are creating a landing or targeted page inside of Eloqua, or a page that is linked to from an Eloqua email. They only work on these Eloqua pages, not in self hosted forms.
If you are going to self host these forms (for example on your own website), here are the steps you can take to remove the tags:
Click the field
Click on the merge settings button
Select None
Note that the yellow disappears
Note that there is no longer a predefined value in the field

How do I select an element based off the value of the parent in an Umbraco.config file?

Please bear with me because I am very new to Umbraco.
I have a test Umbraco config file that looks like the following:
<Product nodeName="For-test">
<customId>222/</customId>
</Product>
<Product nodeName="For-none">
<customId>333/</customId>
</Product>
In my test.master page, I would only like to match the child element who's parent has the value of "For-test". This should give me the value of "222". I am using the following code to display the element values but I get the following error "Error loading MacroEngine script (file: )" I believe that my syntax is wrong.
<umbraco:Macro runat="server" language="cshtml">
#Model.nodeName="For-test".customId;
</umbraco:Macro>
Which Umbraco version are you using? Version 7 is best when using MVC, so you wouldn't typically have a master page at all.
Also, you shouldn't have to be fiddling with umbraco.config at all.
I would suggest you start by installing the starter kit (maybe in a fresh install?), then you can check out how "it" does things. Also, have a good look in the documentation (https://our.umbraco.org/documentation/) and maybe even check out some of the video tutorials (something like these http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/).
As for your specific question:
No need to use the <umbraco:Macro /> tag - but since you are in a Web Forms type website (and not MVC), you can't use # to indicate code sections. You'll have to try with <%= %>.
The Umbraco Model is tied to whatever page you are viewing. You can query for content by Id or "nodeTypeAlias" (which in your case would be "Product", and you'd get all Products at once), but not easily by name since it isn't unique.
But I think you can get a much better grasp of how things are done in Umbraco by looking at the links provided above.
For a detailed error go to App_Data/Logs/ and open the newest .txt file.

How to change URL names in Umbraco

This is my first time round using Umbraco and I have created Document Types / Pages using the wrong naming format and now this has transpired into my page URL's, for instance /about-page/. How would I go about changing them to /about as I have searched the back-end admin panel and there dose't seem to be an option to change their link to document values.
Would anyone be able to provide a simple code based example using umbracoUrlAlias or umbracoUrlName how I could change this preferably in Razor.
Thanks
Editing #run yards Solution by digbyswift help in comment
Correct Solution:
Create Property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlName
Type as text sting
Should not be Mandatory (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Tab as Generic
Click Save on top right on the page
Added screenshot for starter kit on Umbraco v7.2.5
Unless I'm very much misunderstanding your issue, you should just be able to change the name of your page and republish. This doesn't need an additional field, just change the value in the "Properties" tab and republish the page. This will automatically change the URL of the page.
You can also create a property called umbracoUrlName using a TextString property editor. If this has a value then it will generate the URL fragment for the page using this value, rather than the page name. This changes the URL for the page, rather than creating an alias, like umbracoUrlAlias.
Solution:
Create property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlAlias
Type as text sting
Make it required (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Go into all your pages and rename them using the property you just created
Now with your code, say with the navigation where you have used .Url change it to .umbracoUrlAlias and the new URL's will be used.
Note if you don't use .umbracoUrlAlias the links will still be active i.e. they work but they won't be displayed in the address bar as .Url spits out the original ones associated with the page.
You can apply on URL names in web.config:
In section find:
<add key="umbracoUseDirectoryUrls" value="false" />
this will set url names for new created items to name.aspx
If you set this to 'true' then new items will be named like /name/
Additionaly you might want to avoid of Handling some urls by Umbraco pipline, just use this setting - add URLs which must be bypassed:
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />

How to define an MVC site in Sitecore (multisite)

I'm currently using 7.1 update 2 running multiple sites using web forms. I'm starting a new site and want to use MVC but can't get it to work; however, I can get the default "website" to use MVC but not a custom site.
For example, let's say I have two sites, site1 and site2, site1 is web forms and works fine, how do I define "site2" which is MVC? Not sure what the value should be in the "physicalFolder" property. Or the site should be defined somewhere else.
Thanks
<site name="site1"
targetHostName="site1.com"
hostName="site1.com"
virtualFolder="/"
physicalFolder="/site1"
rootPath="/sitecore/content/site1"
startItem="/Home"
language="en"
database="master"
domain="extranet"
allowDebug="true"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
enableWorkflow="true"
patch:before="site[#name='website']" />
The physicalFolder parameter will allow you to specify the physical path that Sitecore will look for any physical files it needs for the specified site. It is one of the options that can be used to organize the physical files for multisite instances.
You will see the following definition in the web.config comments:
physicalFolder: The physical location of files for the site.
If the site is based on physical files, this is the path to the folder holding the files.
For non-physical sites, this is the place where Sitecore looks for a default.aspx file (to start the pipelines).
You can find more information about the physicalFolder parameter here -> http://sdn.sitecore.net/Articles/Administration/Configuring%20Multiple%20Sites/Adding%20New%20Site/site%20Attribute%20Properties/physicalFolder.aspx
As for configuring your MVC site, there really isn't anything special you need to do in terms of your Site definition. You should just be able to replicate your Site1 definition and make the appropriate updates. Sitecore will utilize the correct rendering method based on the Layout and Sublayouts defined on your Pages.
<site name="site2"
targetHostName="site2.com"
hostName="site2.com"
virtualFolder="/"
physicalFolder="/site2"
rootPath="/sitecore/content/site2"
startItem="/Home"
language="en"
database="master"
domain="extranet"
allowDebug="true"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
enableWorkflow="true"
patch:before="site[#name='website']" />

Localization in ASP.NET MVC

Visual Studio 2008
I want to bring some localisation into my ASP.NET MVC site.
Someone suggested creating a resource file "Strings.resx" as a publically strongly typed resource, which works nicely and allows me to write
<title><%= Strings.MyView_Title %></title>
I then proceeded to add a file "Strings.da.resx". This file is created right next to the first one, and defaults to "Access Modifier : No Compilation", whereas the first (the one without language modifier) defaulted to "Interal".
I can see in the bin directory that a directory has been created ("da") with a resource.dll, however, I cannot see any of the translated texts on my site.
I have checked with the browser that the only preferred langauge is Danish (da-DK), but I only see the english texts.
Questions:
1) Do I need to enable something in web.config ?
2) Am i creating the right files, with the correct types (i.e. should #2 be "No compilation") ?
In your views, do you have a page directive?
If so, do you have UICulture="Auto" and Culture="Auto"?
For example...
<%# Page Language="C#" Inherits="..."
culture="auto" uiculture="auto" %>
This will ensure that the Accept-Language header, passed by the browser in the request, gets used to set the Thread cultures. It's the UICulture that influences which resource file to pick.
For more on ASP.NET i18n this book is very good...
http://www.amazon.co.uk/NET-Internationalization-Developers-Guide-Building/dp/0321341384/ref=sr_1_1?ie=UTF8&s=books&qid=1241010151&sr=8-1
It doesn't cover MVC, but covers ASP.NET and, as such, many things continue to be relevant.
First you have to create action filter that will switch culture of request thread.
OR
Set your globalization element to UICulture="Auto" and Culture="Auto"
Check this screencast, it is in Russian but code samples are understandable.

Resources