I want to change language and locale of my application alone to a language different than user's default that is set on the system. Say my application should use resources of french even though the system default is set to English.
I found few examples for iOS (How to force NSLocalizedString to use a specific language) but even this is only for language, but nothing for OSX. I have the french resource in my bundle. I just want to override the defaults for my application alone. Without changing the entire OS locale from system preferences.
There are nice apps for this problem: Language Switcher and App Language Chooser to name a few.
To do it programmatically, you can use the defaults command to change the app's AppleLanguages property to (fr) or (en, ko), as the following shell script:
bundleId=BUNDLE_ID_OF_YOUR_APP # such as, com.apple.Finder
# change AppleLanguages
defaults write $bundleId AppleLanguages "(fr)"
# open your app
open -b $bundleId
# then restore the language
defaults delete $bundleId AppleLanguages
See the answer to this similar question at superuser for more detail: Can I change the default language of a application / program in Snow Leopard?.
Related
I am using Typo3 version 9.5.13 with 16 languages, there is a language 'Macedonian(mk)' and I have added a translation for this language with a key in Typo3 template setup, but it's not taking this translation and shows the default translation. This language is not in the Typo3 Supported languages list.
Thank you
In order for TYPO3 to support "mk" locale (and thus, XLF-based label files with "mk.locallang.xlf") one needs to add this line to typo3conf/AdditionalConfiguration.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user']['mk'] = 'Macedonian';
This is the beginning to make it even possible to allow mk for TYPO3 Backend and Frontend - related to label files (XLF).
The other parts (creating a sys_language record, adding an icon, adding "mk" to the site language etc) are still valid and need to be done as well, in order to determine "mk" in a multi-language setup for TYPO3 Frontend.
Add the language to typo3/sysext/core/Configuration/TCA/sys_language.php
Insert the translation of the language to typo3/sysext/core/Resources/Private/Language/db.xlf
Add the locale to typo3/sysext/core/Classes/Localization/Locales.php
Add the flag icon to the IconRegistry: typo3/sysext/core/Classes/Imaging/IconRegistry.php
Add the icon identifier to typo3/sysext/backend/Configuration/SiteConfiguration/site_language.php
You can see an example for Maori here:
https://github.com/TYPO3/TYPO3.CMS/commit/a8c16c45f8a1fce1d858815cef6c1ad83cff5d76
The only localisation I could find is described here:
https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110018-chromium-language-localization
DotNetBrowser allows configuring Chromium engine with specified
language (two letter code from ISO-639 e.g. "en", "de", "it", etc).
The language will be used for UI text messages localization (e.g. text
on the web page that's displayed when Chromium failed to load URL).
By default, Chromium engine is configured to use .NET application
language that can be received from
theCultureInfo.CurrentUICulture.Name property. To configure Chromium
engine with .NET application language, DotNetBrowser extracts the
language from theCultureInfo.CurrentUICulture.Name property and passes
it to Chromium engine via the --lang Chromium switcher.
If you need to change this default behavior, then you can configure
Chromium engine directly with specified language via Chromium--lang
switcher.
Unfortunately this does not seem to apply any date formatting (which makes sense as it only seems to pay attention to the language "en" and not the locale)
When I print, the header on every page has a date which is in US format. My customers are not in the US and giving them dates in US formats would be a disaster.
Is there any way to set the date format in DotNetBrowser / Chromium?
In Chrome Advanced Settings I can pick English New Zealand and English UK as languages and those settings do affect the printed page headers.
You could specify English UK locale as "en-GB" as shown below:
BrowserPreferences.SetChromiumSwitches("--lang=en-GB");
Do not forget that this switcher should be set before you create any Browser instance.
This article describes how to set Chromium switchers: https://sites.google.com/a/teamdev.com/dotnetbrowser-support/documentation/chromium-switches
I need to know if the current user is being managed by Mac OS X Parental Controls (more specifically, the app age restrictions) in order to block some contents of the app. How can I do that? Any of these will be enough.
Methods that can be achieved with Objective-C, but not necessarily using Objective-C, like bash commands or AppleScript commands, are also accepted.
EDIT: The app age restriction can be found here: https://ibb.co/mOZyww
First, I'm not sure what you mean by
app age restrictions
On macOS 10.13, I only see the option to restrict applications to a whitelist; I can't configure restrictions based on age.
Anyway, parental controls are stored in the local directory services, in the mcx_attributes attribute for the user in question.
(mcx refers to the old Managed Preference framework)
You can browse this via the UI using Directory Utility or via dscl (using the mcx plugin).
If you run dscl, you can then browse the directory services using cd, ls, etc.
For example, I can navigate to my testuser:
cd /Local/Default/Users/testuser
And then dump the parental controls with mcxexport
-mcxexport .
This will give you the configured parental controls in XML format.
Check out dscl . -mcxhelp for more information.
Updated
Toggling the "Restrict: Apps to:" setting updates this preferences key:
<key>gamesLimit</key>
<dict>
<key>state</key>
<string>always</string>
<key>value</key>
<integer>300</integer>
</dict>
You would have to play around with it to figure out the corresponding values (e.g. 300 == Age 12+)
I need a way to get & keep permission to write to a specific directory in OS X. How can that be done while abiding with the new Sandbox requirements?
The recipe:
Ask the user to select the directory - use a standard open dialog limited to directory selection. Apart from a few special directories (music, pictures etc.) there is no way to gain access apart from asking the user.
Create a security-scoped bookmark using the URL returned by the standard open dialog, just search the Apple docs for "security-scoped bookmark".
Persist that bookmark, either in user preferences or in the Application Support folder for your app.
On application launch, or before you need access, read in the saved bookmark and activate - you'll find out how to do this in the Apple docs as above.
I am working on a website in dnn. I want to change the language of website or particular page. So I download the language package for spanish(es-es),chinese(zh-cn) and install them from host. Next when I changed the language of browser then the website language didn't change. Working on dnn 5.0.
Please let me know how I can use language packages in dnn website.
For initial translations and maintenance of DotNetNuke translations, I recommend the use of OmegaT. It handles resx files directly. And content (such as HTML or Blogs) can be downloaded, translated and then uploaded thanks to the APIs of DNN (drop me a note if you need the scripts).
OmegaT stores the translations in it's memory (a TMX file, which is actually some kind of XML). It also uses Google Translate and similars, and has a fast user interface which increases translation speed a lot when compared against continously waiting for DotNetNuke to handle your updated resources.
More info on OmegaT. An example of a translated site and modules: site translated from Dutch into English
You should probably ask this in the DotNetNuke forums: http://www.dotnetnuke.com/tabid/795/default.aspx.
There's one dedicated forum for questions about language packs and localization. You will probably find your answer there: http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/77/scope/threads/Default.aspx
The language packs don't always have translations for everything on the site, especially content that you added yourself. You'll need to do two things to get them working properly:
Go to Admin > Languages, and enable the languages you want to use.
Open the Language Editor and start translating. Under each resource name, you will see an edit text box for the localized value, and a read-only text box for the default value. In most cases, you'll need to translate verbatim what you see under "default value".
We had to write our own menu provider to get the menu to do this - instead of going for the resource files we went for a database solution - other reasons applied to this as well - we also built an interface for doing this - as for things like the text/html module there are some third party builds that allow you to nationalize content. Apollo comes to mind Apollo Software they have some multilanguage modules
The language packs will typically only localize text used by the core such as "Login" and "Settings". It is designed so that you can have a site in a language other than English, not so you can have multiple languages on one site. You can easily have multiple portals, each with a different language.
In order to have multiple locales on one portal you will need to use a third party module or develop your own.