In my Windows Store App application I have an option to switch the language by setting ApplicationLanguages.PrimaryLanguageOverride to the locale I want to use.
I have different resource files for each language and it works fine for reloaded pages and resources loaded from code-behind.
But now there is a problem with cached pages (NavigationCacheMode = Enabled): those pages have text localized directly in xaml using uids, and those don't get reloaded when the language changes.
Any idea how to reload those resource tagged as uids without restarting the app?
For me worked deleting the Navigationcache like that after switching the primarylanguageoverride:
var Frame = Window.Current.Content as Frame;
Frame.CacheSize = 0;
Frame.Navigate(Frame.CurrentSourcePageType);
Frame.CacheSize = 10;
Frame.GoBack();
After that the Current Page is reloaded in the correct language.
Related
I want to create a multilanguage site in contao.
What I did so far:
At first I copied the Page tree of current language.
At second I added domains like example.com/de and example.com/en in site-structure "Domain name" of both root pages.
Edit: Finally I added app/config/config.yml
contao:
prepend_locale: true
For my assumption it should work now but it doesnt.
What else is necessary to make it work.
In your case you do not configure any DNS names for your website roots, since you are using only one domain. Instead, you should use the following in your app/config/config.yml:
contao:
prepend_locale: true
Clear and warmup the production cache afterwards. This will generate URLs like example.com/de/… and example.com/en/….
See also https://github.com/contao/core-bundle#configuration
I'm building a multilingual site in Kentico where I want a user to have limited access to the languages that they can create in the Pages application. I can specify which languages the user can edit using the Languages tab in the user properties as shown in the User management page in the Kentico documentation.
The result of this is that if my user tries to view a language that they have not been assigned to and has no page created yet is that they receive a permission error/warning:
You are not allowed to create this culture version.
What I want to do is limit the drop-down list in the Pages application so that I can only select languages that I have permission to change. I can't find any settings that might limit the drop-down to assigned languages only.
Ideally, the user should only be able to see pages that they can edit in the Pages application for my use case as there are in excess of 30 languages.
How can you limit the UI language drop-down to show only languages that the user is allowed to see?
The language drop-down in the pages application is ultimately provided by the LanguageMenu control (which you can find in CMSModules\Content\Controls\LanguageMenu.ascx). You need to make a copy of this and modify the Page_Load method in order to limit the languages base upon the set cultures (if any).
A very quick example is to add the following code before the loop that builds the list items:
var userCultureIDs = new List<Int32>();
var userCulturesSet = false;
if (CurrentUser.Bindings.CollectionNames.Contains("UserCultures") && CurrentUser.Bindings["UserCultures"].Count > 0)
{
foreach (var userCulture in CurrentUser.Bindings["UserCultures"])
{
userCultureIDs.Add((Int32)userCulture["CultureID"]);
userCulturesSet = true;
}
}
and then inside that loop, make the first line:
if (userCulturesSet && !userCultureIDs.Contains(culture.CultureID) && !CurrentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) continue;
This ensures that if you're Global Admin, you get everything and that - if no languages are set - you get the default list.
As is usual with best practice, you're better off making duplicates of these controls before you modify them to make sure that you don't cause any unintended side-effects. Keeping that in mind, be aware of the control chain:
CMSModules\Content\CMSDesk\Default.aspx
CMSModules\Content\Controls\ContentNavigation.aspx
CMSModules\Content\Controls\TreeLanguageMenu.ascx
CMSModules\Content\Controls\LanguageMenu.ascx
I have been going through the process of localizing my apps and in doing so I temporarily set the language to Chinese like this:
ApplicationLanguages.PrimaryLanguageOverride = "zh-CN";
However, after commenting out the line and rebuilding / re-deploying, now my app is still stuck in Chinese instead of what my development machine's default language at the OS level (English)!
How do I reset this to go back to the default OS setting?
Just assign an empty string to the PrimaryLanguageOverride property :
ApplicationLanguages.PrimaryLanguageOverride = string.Empty;
The PrimaryLanguageOverride setting is persisted between sessions. It
should not be set each time the app is loaded. It should only be set
based on user input presented in settings UI. The property can be read
at any time. If the property has never been set, it returns an empty
string.
So if you set the property to an empty string, the app will use the default language.
I am managing an association's site using typo 3 version 4.5.30. The site has the config setup for [baseURL] = http://www.afj-japon.org/ in its template.
Everything works fine, but I need ONE page only to have the URLs written in full in the code.
Right now the page code indicates
and the URLs are written in full for the redirections to other pages, but as for the images.
I need to have the code to actually be as
How can I set this to affect only this one page and not the whole site ?
Thank you in advance for your help.
Regards,
Gilles
if I understand the question right you want to have absolute URLs on one certain page, right?
TYPO3 comes with a setting called config.absRefPrefix.
If said one page has no child-pages you can set up an extension template on that page and have this line in there:
config.absRefPrefix = http://www.afj-japon.org/
If the page has child-pages underneath it, you will have to use a condition in the ID of that page.
[globalVar = TSFE:id = PAGE-UID]
config.absRefPrefix = http://www.afj-japon.org/
[global]
Mind that every condition has to be evaluated prior to caching so having a lot of conditions might make your website slower.
I wanted to add a new search engine to be displayed in the drop down for search bar that appears in firefox nav-bar. And set this as the default searchEngine when user sets it through my extension's preferences.
For a non-restartless extension, through XUL, we use Components to do something like this:
Cc["#mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService).addEngineWithDetails(...); //Adds a new search engine
Cc["#mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService).currentEngine = ...; //sets the current search engine value.
How can I do something similar in a restartless extension created using Firefox addon-sdk? One problem I see is that there is no stable API to get and set firefox preferences listed at 'about:config'. But even if I use the unstable preferences service documented here, I am not able to do default search engine changes through extension. Help please!
Search in Firefox has two pieces you have to worry about.
First for the Search Input
You're actually going to use the same system for setting the search engine but you'll need to load the chrome module in the SDK.
var { Cc, Ci } = require("chrome");
var SearchService = Cc["#mozilla.org/browser/search-service;1"].getService(Ci.nsIBrowserSearchService);
// Add your engine to the list of engines in the drop down
SearchService.addEngineWithDetails('yoursearch', 'icon', 'yoursearchalias', 'your search description', 'get', 'http://stackoverflow.com/search?q={searchTerms}');
// Set your engine as the currentEngine so it's the default engine for the search input
SearchService.currentEngine = SearchService.getEngineByName('yoursearch');
Next for the URL bar
Update: As of Firefox 23 the keyword.URL preference has no effect, the above code will change the default behavior in both areas.
If you wanted to alter the search engine that's used for the URL bar you'll have to work with the user preferences.
var preferences = require('sdk/preferences/service');
// the 'search keyword' will be appended to the url you provide so strip out the
// {searchTerms} OpenSearch identifier
preferences.set('keyword.URL', 'http://stackoverflow.com/search?q=');
// When you want to set things back just reset the value
preferences.reset('keyword.URL');
Good luck!