Creating a multilingual link to a CMS page in Prestashop - hyperlink

I want to make a link to a CMS page in prestashop, the webshop has 3 languages. How do i make the link autoswitch the language?
When you make a cms-page, you can enter the translations for the title of that page. So i have to get that title in the code?
This is what i have now (which stays in English when i switch the language):
<a href='{$link->getCMSLink('8', 'about-us')}' title='{l s='About us'}'>{l s='About us'}</a>
Thanks!

Why don't you simply only pass the id_cms parameter? By providing an alias, you force the dispatcher to use this alias when creating the link.
If you use {$link->getCMSLink('8')} Prestashop will get the current language and find the proper alias in that language.

Related

How to apply i18n on whole website by a single click in Struts 2

Is it possible to apply Struts 2 Internationalization (i18n) for changing language from English to Hindi on whole web pages of website by single click?
If it is possible then how can I resolve this problem?
As mentioned by #RomanC , it is possible to do that, you need to have the i18n interceptor in your package.
After that you need your jsp page submit a form with request_locale in it, or call an action with request_locale in its parameters . For example, if you want to do it with select you can use below:
<s:form id="langselect" action="locale-manager" namespace="/common">
<s:select name="request_locale" headerKey="-1"
headerValue="Language"
list="#{'en_US':'English', 'fa_IR':'فارسی','ar_SA':'العربية','zh_CN':'中国的'}"
onchange="forms['langselect'].submit()" />
</s:form>
You form action needs nothing to do about changing the locale at all, as the interceptor will do all the job for you.
Changing the locale will change all your 20 pages at once, of course as soon as you reload your pages. So if you want to do it with tab you need to reload your new pages (for example with ajax) or reload your total site to get localized jsp from struts.
The framework is internationalized.
You need to add the corresponding to each locale resource bundles for
the localized messages that you display via the struts tags. Use
text tag or getText() to retrieve a message in the UI.
The browser language is passed with the HTTP request and framework
create a locale corresponding to the browser settings. Switching
locale performed via passing a special parameter request_locale to
i18n interceptor that should be on your stack.
You can also configure this interceptor to accept user-defined
parameters.
Normally switching to a locale persist for the session of the user.
So, you don't have to pass a parameter each time on every request, but
this case is also supported if needed. See how could you achieve all
of the above using localization.

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" />

Same link in menu and in footer are in different languages

My ASP.NET MVC 4 website URLs looks like this "/language/controller/action".
HTML code of link in menu and in footer are the same.
<li>Website development</li>
When site is opened in "en-GB" culture link in menu pinting to
/en-GB/Service/WebsiteDevelopment
But link in footer is
/hy-AM/Service/WebsiteDevelopment
How it is possible? How can I fix this?
You don't specify "language" in Url.Action, so it probably takes the default language.
ASP.NET links are absolute ones, so without specifying the language, it's
/default-language/controller/action
If you want the language to be taken from the current URL, you need to write your own Url.Action function, or extend it.
Last menu was changing entire language to Armenian. Aa a route value it takes place after that function.

AttributeRouting generate links with specified language

I would like to know if there is some way to using Html.ActionLink to set in which language has to be generated the URL of link using AttributeRouting. I have tried with:
Html.ActionLink("DescriptionLinkText", "Controller", "Action",
new { language="en" }, null)
but it doesn't work. Is there a way to set to AttributeRouting in which language has to be generated the URL.
What I need is to put at the top of my website links to change the current language. For example if the user is at /en/contact and click on links to change to spanish I want the same page was reloaded but in spanish language /es/contacto instead of redirecting to home page, for this reason I need to generate URL's in different culture of CurrentCulture to allow to change language and continue to the same page.
Thanks for your help
Why don't you use resources for localization?
#Html.ActionLink(LocalizedResources.ActionLinkLabel, "Action", "Controller")
update:
#Html.ActionLink(LocalizedResources.ActionLinkLabel, LocalizedResources.Action, LocalizedResources.Controller)

Rails 3.1 build GET form that creates a custom URL route that is SEO friendly

I would like to create custom SEO friendly routes similar to what is used by http://realestate.com.au For example the following page is shown by google when the search term "real estate melbourne" is used:
www.realestate.com.au/buy/in-melbourne,+vic+3000/list-1
I would like use the following format. mysite.com/trips/search/melbourne-to-sydney/01-01-2011
I have configured the routes in my routes.rb file to get it to pick up the correct parameters when a url is entered is this format.
routes.rb
match '/trips/search(/:fl(-to-:tl(/:tripdate)))' => 'trips#someaction'
My question is how do I setup a form in rails 3 to send a GET request using the above url structure. I have tried playing around with to_params though it seems to then change all my edit, show links etc which is not intended. I could build the link using javascript though I guess this would be a hacky option and the site would not work if javascript was disabled.
Is there a neat way to be able to create a GET submit form in Rails 3.1? The fields are select lists containing name and ids.
Thanks for your help.
This will help you immensely with the friendly URL portion
http://norman.github.com/friendly_id/file.Guide.html
https://github.com/norman/friendly_id

Resources