Laravel: How can I have the same page in two different languages? - laravel

Each page I create must have an english and french version. I want to have two flags in my header and when I click on the US/UK flag I get the english version and my clicking the french flag, I get the french version (pretty much the same as the polylang plugin in WordPress).
I know about locales in Laravel. But what I need is, that each view has it's counterpart. For example I have views/welcome_en.blade.php and view/welcome_fr.blade.php - what I want is that when someone opens the corresponding route example.com/welcome, the corresponding counterpart url example.com/fr/welcome is passed with that view.
My question is: How can I build the same multilingual Laravel as Polylang offers in WordPress by just simple clicking a flag and changing the whole view with it's corresponding counterpart (getting the counterpart link back)?

Related

Changing sap ui5 application locale dynamically in the application

I have two different language i.e English and German in my web app and user can change the language in application through a select box. Initially i am getting preferred language from the back-end and i am setting locale of the core as follows.
sap.ui.getCore().getConfiguration().setLanguage("//according to whatever is coming from back-end")
Now lets say initial language is English, if user open a control i.e sap.m.datepicker, calendar is being displayed in English. If user changes the language to German from the application i am again changing the language in the core as shown below:
sap.ui.getCore().getConfiguration().setLanguage("de-DE")
Now if user opens that same datepicker, it is being displayed in English instead of German and if user opens some another control or datepicker it is being rendered in German.
Page is not getting refreshed while changing the language in app.
Please suggest me a solution to dynamically change the locale of the controls.
Maybe my answer here helps a little.
The problem is that in many cases, maybe even in most cases, the standard UI5 controls detect the language only once when they get loaded. Very often, the control developers did not implement a "dynamic change" of the language. If you check the link I mentioned above you will see that there are ways to react on language changes, but very often this is not implemented for whatever reason.
However, I'm afraid to tell you that in your case the standard control might not support dynamic language changes out of the box (but I did not check the code). Also, it seems that the UI5 guys at SAP do not consider this as a bug (see this github issue). Such a pity...
I would suggest you use sap.ui.core.Core.attachLocalizationChanged(fnFunction, oListener) and add this to the onInit function of your controller.
From this, in your fnFunction rebuild the controls where you require the locale changes to be dynamic.
example:
onInit: function(oEvent) {
sap.ui.getCore().attachLocalizationChanged(this._handleLocalizationChanged, this);
},
_handleLocalizationChanged: function() {
// ... Some logic to re-build / set locale for the dynamic controls.
}
This is my interpretation of what should be done based on the information in the api

Language changes when I change page in magento

I have one problem in my site. I have two languages installed, Portuguese and English(default). On my front end when i change from English to Portuguese it makes it all right but when I switch page (for example, try to see one category) it switches back again to English language.
I've tried to change cookie lifetime and some other things but didn't work.
What can I do in order to "save" the language selected and keep it on every pages that I try to access?
You need to have two different store views in your magento install one for english and one for Portuguese.

How to change Back to top label in Joomla 3 template Protostar

Protostar is Joomla 3 default template. In the footer part, there is a link Back to Top which returns the user to the upper part of the html page.
The only document in which I have found this text so far is on location:
templates/protostar/language/en-GB
But, the change of the text didn't actually change it on website. So, I suppose there is another location for this.
Where can I go and change it?
When the template is installed, that file would get moved to language/en-GB/en-GB.tpl_protostar.ini, so that would be the file that actually needs to get updated.
That being said, a better method is to use the language override feature on the admin side. You'll see in that file that the language key is TPL_PROTOSTAR_BACKTOTOP (what is to the left of the equal sign).
On the admin side, go to Extensions -> Language Manager. Then on the left side of the page, click "Overrides". Hit the new button and add TPL_PROTOSTAR_BACKTOTOP as the constant and whatever new text you would like there in the "Text" box.
By using the override feature you protect your site from updates if the template's language file is updated in a later version.
If you want to use your site with other languages than English, create the respective template language pack in folder templates/protostar/language/
As an example: If you use German on your site, create a folder named de-DE, copy the english files en-GB.tpl_protostar.ini and en-GB.tpl_protostar.sys.ini into it and change their names to de-DE.tpl_protostar.ini and de-DE.tpl_protostar.sys.ini. Now you can change the respective line in de-DE.tpl_protostar.ini to TPL_PROTOSTAR_BACKTOTOP="nach oben"

Troubleshooting a multilingual joomla 3.2 site after changing the language title

I made a complete bilingual joomla (3.2) site which was working perfectly fine until I tried changing the title of the English language from "English (UK)" to just "English". The reason I did this is because I only want to see "English" on the front end to switch to English.
Even after changing the language title back to "English (UK)", it did not work anymore.
Basically I have tow questions:
How do I get the English switch working again and
how do I get rid of the country tag i.e. DE and GB?
Problem solved: It looks like it was a bug in Joomla, the error has been reported.
There is two solutions I encountered, I only tried out the first one, so I don't know whether the second one works.
Go to the Content Language tab in the Language Manager
Open the language en-GB for Edit
Change the Access from Guest to Public
Save the changes
Invoke phpMyAdmin
On the left panel double click on the database that is being used for your site
On the left panel click on the table named xyz_languages (where xyz_ is the table prefix for your site) and on the right side you would notice rows from the table
On the right panel, click on the link Edit that is against the row with lang_id 1
In the resultant window on the right panel for the column Access change the value from 5 to 1
Save the row
Note: Make a back-up of your database content before making this change.
Apparently, this should be resolved in the next release of Joomla!. Suggest reviewing the tracker http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33034 and the Github pull request https://github.com/joomla/joomla-cms/pull/2714.
Removing the (DE) and (UK) parts of the language switcher module was easy, just change the title native in the content tab of the language manager. Just make sure that the access is set to public.

Where to find the tags used in theme short codes? As well as the general tags used in pyroCMS?

I was wondering where to find the tags to type to take advantage of shortcodes programmed in themes. Many themes have them, such as the one below. However I can never find the information required to make use of them in the read me's or on site documentation. Which makes using them impossible for me. Is there a specific html, css, or php file that is consistent to each theme and shows them?
Given the lack of write ups on what tags to use suggests that theme creators expect people to know which file to find them in.
https://www.pyrocms.com/uploads/default/store/listings/11-25-2012_9-41-20_PM.png
https://www.pyrocms.com/uploads/default/store/listings/11-25-2012_9-41-20_PM.png
On a more PyroCMS rather than theme specific note, is there a list of all tags and their uses? Such as {{ settings:site_name }}, or the page body tag. Every link I have found to a list says that the list has been moved.
Thank you for your time once again.
Open up your file directory and navigate to:
path/to/your/files/system/cms/plugins/theme.php
Each one you can use is listed here along with an example in the function description. Each plugin in this folder is lined out the same way (files, session, asset, etc). You should be able to view each one and play with how to incorporate them into your project.
Edit: Also, you can find more information here: http://docs.pyrocms.com/2.1/manual/plugins
Notice that this is specific to version 2.1. If you are not using 2.1, in the top navigation add click on documentation and then select your version.

Resources