Menu
  • HOME
  • TAGS

What is wrong with my mongodb?

django,mongodb,locale,virtualbox,ubuntu-14.04

Install swedish locale. sudo apt-get install language-pack-sv ...

GWT: how to use Locale.ENGLISH in client side?

java,gwt,locale,emulation

Locale is only supported in GWT 2.7.0 (RC1) and up. Here are the release notes of GWT 2.7.0 (RC1), specifically: "New emulated classes: Locale, NavigableSet, and NavigableMap" and "New emulated methods in Class, String, ..." If you're using GWT 2.6.1, Locale and String#toLowerCase(Locale) won't be available....

Locale and specific date format with Moment.js

javascript,localization,locale,momentjs

Okay. This is a little awful, but you knew it was going to be. First, you can access the actual format string for (for instance) 'L': var formatL = moment.localeData()._longDateFormat.L; Next, you can perform some surgery on it with judicious regex replacement: var formatYearlessL = formatL.replace(/Y/g,'').replace(/^\W|\W$|\W\W/,''); (Which is to say:...

Symfony2, get locale in repository class

php,symfony2,repository,locale

If you need to use the locale in a query, you can try to get the locale in the controller and then use it as parameter in the repository function: $locale = $this->get('request')->getLocale(); $result = $this->getDoctrine()->getRepository('AcmeMyBundle:MyEntity')->findNtecByIdAndLocaleOrSomething($id, $locale); The problem with this approach is, you will have to pass the locale...

Symfony routing - locale as subdomain with fallback to default

php,symfony2,routing,annotations,locale

Well, looks like triple annotation routing to handle locale + subdomain is the only choice for now. Studying documentation (for example, this article) shows that Symfony developers encourage us to do it that way, which, to me, is not that nice. However, here's the solution... /** * @Method({"GET"}) * @Route(...

How to set a double format by locale

java,locale,number-formatting,decimalformat

You can't present double or float in format 10,000.2 or 10 000,2, this is String format. You can use for example String.format() method to do it. More info about this read here.

Unparseable Greek date - SimpleDateFormat

java,locale,simpledateformat

a) First to say, never user the expression new Locale("el-GR"), instead use new Locale("el", "GR") or without country new Locale("el"), see javadoc for correct usage of constructors (because there is no language code "el-GR"). b) The exception you observe (and me, too, but not everyone) is caused by the different...

How should one redirect locale-less URIs to locale-full ones in Symfony-CMF?

php,symfony2,routes,locale,symfony-cmf

we use a custom 404 handler and lunetics: exception_listener: class: AppBundle\EventListener\ExceptionListener arguments: container: "@service_container" tags: - { name:"kernel.event_listener", event:kernel.exception, handler:onKernelException } and the php class class ExceptionListener { /** * @var ContainerInterface */ protected $container; public function __construct(ContainerInterface $container) { $this->container = $container; } public function onKernelException(GetResponseForExceptionEvent $event) { if...

Change locale in android app (onto Hindi)

android,locale,hindi

It depends on the device. Once check your device supports Hindi language by going Settings --> Language & input.

How to read Cyrillic Unicode file in C++?

c++,unicode,locale,getline,cyrillic

Well, figured out the way: FILE *input= _wfopen(L"test.txt", L"rb"); wchar_t line[1000]; test.txtfgetws(line, 1000, input); Works fine like that. Was quite stupid of me not to try it first. So thanks everyone....

Spring MVC 3.1 change language i18n based on the request locale language

java,spring,spring-mvc,internationalization,locale

Thanks to you M. Deinum. Here is the solution: The solution is to use the AcceptHeaderLocaleResolver as LocaleResolver. I should have read the documentation better. applicationContext.xml: <!-- Internationalization i18n and l10n --> <!-- to activate message.properties --> <bean class="org.springframework.context.support.ReloadableResourceBundleMessageSource" id="messageSource"> <property name="basename" value="classpath:messages"></property> <property name="defaultEncoding"...

How to add more locale (Switzerland) to android

android,locale

I think important for you is: German, Switzerland (de_CH) French, Switzerland (fr_CH) Italian, Switzerland (it_CH) Also have a look at this SO question...

Filter listview in other language beyond english

android,listview,locale

It does not have to do with the language. If you Strings are written in Greek and your keyboard has the Greek Language then you should be able to filter the listView in Greek and so on. Hope it helps!!!...

Android - Support Multilanguage app in a ViewPager

android,android-viewpager,locale,multilanguage,screen-rotation

you can stop reloading application when orientation changes, by adding to your manifest : <activity android:name=".MainActivity" android:configChanges="orientation|screenSize"> </activity> and to your MainActivity: public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); // Checks the orientation of the screen if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){ } } or you...

How to display checkbox on the left when change language of Android app to Arabic?

android,checkbox,settings,locale,arabic

To take advantage of RTL layout mirroring, simply make the following changes to your app: Declare in your app manifest that your app supports RTL mirroring. Add android:supportsRtl="true" to the element in your manifest file. Change all of your app's "left/right" layout properties to new "start/end" equivalents. For more details...

FacesContext#getViewRoot() returns null while setting for first time

jsf,locale,jsf-2.2,mojarra

I reproduced your problem. This is the consequence of issue 3021 which was applied since Mojarra 2.2.5. The locale is now determined during view build time. Previously, at time of writing the answer you found, the locale was determined during view render time which allowed the code to find view's...

getting Locale session on Laravel and selecting query accordingly

laravel,locale

Make sure you always have a fallback return value when using if-statements. $listings = []; // this will be the default return value if no condition is met if (\Session::get('locale') == 'en') { // query for listings in 'en' } else if (\Session::get('locale') == 'es') { // query for listings...

What information do browsers use to create the Accept-Language string?

google-chrome,http,firefox,locale

This will likely depend on both browser and platform. On unix type operating systems you can find the system locale with the locale command: $ locale LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL= You can also set this using the same command, or via the OSX system preferences app....

Two records in database on 1 form

php,symfony2,doctrine2,entity,locale

If you want to retrieve some specific content based on the locale, you need to create an array where you set your fields ordered by locale and create a query that uses this array. You could do it this way : class PageLocaleManager { public function getParametersLocale() { // retrieve...

Angular Dynamic Locale not working instantly

angularjs,localization,datepicker,locale,angular-ui-bootstrap

Never mind, I actually found a solution which does not involve dynamic localization. As proposed by will Farrrell, I detect the user's locale right in the header of my index.html and load the according locale: var locale = window.navigator.userLanguage || window.navigator.language; if (locale) { var smallLocale = locale.toLowerCase(); document.write('<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.2.15/angular-locale_'...

NSLocale to Country name [closed]

ios,facebook,swift,locale,nslocale

Working off of this SO question, I've whipped up a Swift translation. Try this: let locale: NSLocale = NSLocale(localeIdentifier: result.locale!) let countryCode = locale.objectForKey(NSLocaleCountryCode) as String var country: String? = locale.displayNameForKey(NSLocaleCountryCode, value: countryCode) // According to the docs, "Not all locale property keys // have values with display name values"...

Java format double value with german locale

java,formatting,format,locale,number-formatting

Try: String pattern = "#,##0.00"; This pattern tells a DecimalFormat to add the grouping character to the given number. Edit: Originally I wrote this with zeros, but this would actually create extra zeros for small numbers. Use the # pattern where you don't want initial zeros....

Identifyng the date format

java,date,locale

Probably the only way this might make sense is as 114-07-11, as if a programmer had forgotten to add 1900 to the return value of year taken from a Date. So: July 11, 2014. Chances are, that this programmer also didn't add 1 to the month, so it might just...

Can I split up language files in Laravel to organize my locale file(s)?

php,laravel,locale

Yes you can, you only have to use the file name in the key of the message like this: /app /lang /en messages.php other.php In the "other.php" file: <?php return array( 'welcome' => 'Welcome to our application' ); In your controller or in a blade template yo can get the...

I want my string to converted to a day [duplicate]

java,locale

String dateString = "29/04/2015"; DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); Date date = dateFormat.parse(dateString); SimpleDateFormat formatter = new SimpleDateFormat("E", Locale.no_NO); String day = formatter.format(date); Now day will have the day in given locale. Update ...

GCC, std::ctype specialisation & streams

c++,unicode,locale,iostream,facet

Use std::locale::global(): std::locale::global(std::locale(std::locale(), new std::ctype<char16_t>())); ...

laravel default localizations for other languages?

locale,default,laravel-5

Some people have published a few. See for example https://github.com/caouecs/Laravel-lang

JSF 2 - Independent locale settings for different pages

java,jsf-2,locale

You need to check desired Locale every time you open a new page and change it before page has been rendered. You can achieve it by using <f:event type="preRenderView" ...> look at this question for details: Initializng a Backing Bean With Parameters on Page Load with JSF 2.0

How to get ISO currency code by country code in rails?

ruby-on-rails,ruby,locale,currency,country-codes

I have tried this answered by @Prakash Murthy. But there are many issue in this http://www.currency-iso.org/dam/downloads/table_a1.xml I found there is not proper name of all countries and some country has multiple currency_code which made me confused. But finally I found the solution by this single countries gem without creating any...

date() does not respect the current locale, while strftime() does

php,date,locale,strftime

From the manual: To format dates in other languages, you should use the setlocale() and strftime() functions instead of date(). So what you're seeing is expected behavior. Use strftime() for locale formatted dates, and date() when that is not necessary....

What is this error about perllocale in Perldoc?

osx,perl,debugging,documentation,locale

I got the exact same error on OSX Yosemite 10.10.3 [email protected]:~$ perldoc perllocale Error while formatting with Pod::Perldoc::ToMan: at /System/Library/Perl/5.18/Pod/Perldoc.pm line 1346. at /usr/bin/perldoc5.18 line 11. Got a 0-length file from /System/Library/Perl/5.18/pods/perllocale.pod via Pod::Perldoc::ToMan!? at /usr/bin/perldoc5.18 line 11. [email protected]:~$ The command perldoc -l perllocale shows the path the the file:...

Detect changes in user locale setting (Control Panel -> Clock,Language and Region) in child dialog box

winapi,locale,regional-settings,control-panel

WM_SETTINGCHANGE is sent to top-level windows only. So if your child window needs to know about it, have your top-level window forward it on (i.e. with SendMessage(hwndChild, uMsg, wParam, lParam); or similar).

Get system language setting on Xamarin iOS

ios,localization,xamarin,locale

Ok, I found a solution based on this very similar thread: On iOS you can get the current language code as the first item of the "preferred languages": NSLocale.PreferredLanguages[0] On Android the cross-platform solution works just fine: CultureInfo.CurrentCulture.TwoLetterISOLanguageName To make the language code accessible to the shared code, I'd recommend...

Print all std::locale names (Windows)

c++,windows,c++11,boost,locale

I wrote a program to print all supported locale names. #include <Windows.h> #include <iostream> #include <string> #include <vector> #include <algorithm> #include <ostream> #include <iterator> using namespace std; vector<wstring> locals; BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) { locals.push_back(pStr); return TRUE; } int _tmain(int argc, _TCHAR* argv[]) { EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL,...

Display current local time in Sofia in Hours : Minutes 24h format

javascript,asp.net,arrays,locale

You can convert to various time zones using toLocaleString . Or use moment.js. Check this post. Here is a fiidle http://jsfiddle.net/tva7o4jx/ new Date().toLocaleString('en-US', { timeZone: 'Europe/Sofia' }) ...

What is the correct way to get a LOCALE_SSHORTDATE that is guaranteed to have a full (4-digit) year number?

c,winapi,locale

No you can't rely on LOCALE_SSHORTDATE having a four-digit year, since the user is able to configure this through the Region control panel and options with two-digit years are available. If you want to enforce a four digit year (and override the user's preference) you may as well just provide...

utf-8 characters get lost when converting from list to data.frame in R

r,utf-8,character-encoding,data.frame,locale

This is not a perfect answer, but the following workaround solved the problem for me. I tried to understand the behavior or R, and make the example so that my R script produces the same results both on Windows and on Linux platform: (1) Get XML data in UTF-8 from...

DBCC USEROPTIONS server/client

sql-server,locale

In a word, yes. This setting is set on the login that the connection is using and changes all sorts of subtle behavior. Dates are especially affected (first day of the week etc). To view the default language settings for all logins run the following: SELECT name, sp.default_language_name FROM master.sys.server_principals...

How do I get locale information about logged-in user from an administrator process on Windows XP in c++?

c++,windows,user,locale

I would do it in the following way: Enumerate logon sessions using LsaEnumerateLogonSessions Call LsaGetLogonSessionData to get logged on user SID identifier. Call ConvertSidToStringSid function to get a string representation of a sid. Look up registry setting HKEY_USERS[USER_SID_STRING]\Control Panel\International This key has all sorts of information needed, and looks like...

Effect of Locale on Android Geocoder

android,locale,geocoding

Unfortunately I don't have a great answer but from what I gather this is what I think you should do. I would double check that you are not seeing a crash or exception thrown from the Geocode api on your users devices. If the case is still that you are...

Why is wstring_convert throwing a range_error?

c++,c++11,locale,wstring

Yourwifstream and wstring_convert are using different facets. wifstream is using a locale-dependent conversion facet; it pulls it out of std::locale(""), with which it was imbued, via std::use_facet wstring_convert was given a locale-independent, standalone codecvt facet, and the one provided by your implementation apparently does not convert UTF-8 into anything fitting;...

Encoding Problems when running an app in docker (Python, Java, Ruby, …) with Ubuntu Containers (ascii, utf-8)

java,python,ruby,docker,locale

You need to set the locale correct. This is the minimal correct Dockerfile: FROM ubuntu:lastest RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 The usual docker images don't specify a locales. You see it if you bash into it and execute locale: sudo docker exec -i...

Is it bad that LANG and LC_ALL are empty when running `locale -a` on Mac OSX Yosemite?

c,osx,locale

I would guess that the GTK warning is because GTK is actually trying to use the Mac language and locale settings from System Preferences to make a locale identifier string, using that string with setlocale(), and being told that the C library doesn't support that locale. As a result, it's...

Thymeleaf compare #locale expression object with string

conditional,locale,thymeleaf,spring-el

This is a issue that I told to the guys of thymeleaf time ago. You need to resolve first the #locale before comparing it with "en". You can do that adding 2 underscore at the beggining and end to the expresion that you want to resolve first. In your case...

Android app Locale variable comparison with String

android,if-statement,locale

Try the following solution: private static final LOCATE_TEXT="fr"; Locale frLocale = new Locale(LOCATE_TEXT); Locale usLocale = new Locale("en"); Locale currentLocale = Locale.getDefault(); Toast.makeText(this, frLocale.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(this, usLocale.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(this, currentLocale.getLanguage().toString(), Toast.LENGTH_SHORT).show(); if(currentLocale.getLanguage().toString().equals(LOCATE_TEXT)){ currentLocale.setDefault(usLocale);...

Get Selenium WebDriver locale

java,selenium,webdriver,locale

You can execute the following JavaScript in WebDriver to get it correct: var language = window.navigator.userLanguage || window.navigator.language; ...

DoctrineExtensions translatable in ZF2 - how and where can I setDefaultLocale

php,zend-framework2,locale,doctrine-extensions

So my mistake was, that I configured the TranslatableListener twice. In my doctrine configuration (only for explanation there is a comment before, delete the whole line): 'doctrine' => [ 'eventmanager' => [ 'orm_default' => [ 'subscribers' => [ 'Gedmo\Timestampable\TimestampableListener', 'Gedmo\Sluggable\SluggableListener', // 'Gedmo\Translatable\TranslatableListener', ], ], ], and in bootstrap: // sets...

Tornado Localisation, set default language

localization,internationalization,locale,tornado

The default language is primarily used to tell Tornado what language the text in your code is: when the current language is the default, no translation files are used. If the text in your code is English but you want to use the German translation files no matter what the...

Does the weekdaySymbol list always start with Sunday in any country?

cocoa,cocoa-touch,localization,locale,nslocale

Yes. Sunday is always the weekday that comes first in that list. You can interrogate NSCalendar to find out what position in that list the week is considered to start on (Sunday for Americans, Monday for Europeans, etc).

Google App engine: List of available locales for PHP

php,google-app-engine,localization,locale

Google App Engine supports only standard "C" locale.

Android Notifications Locale specific message with Unicode

android,unicode,locale

If you are sending encoded Unicode of that particular language then try commons-lang-2.6 jar by this link http://java2s.com/Code/Jar/c/Downloadcommonslang26jar.htm Use: add this line to your notification class StringEscapeUtils.unescapeJava(text) //here text(Notification text)must be Unicode of that language ...

Angular Filter Service inside Controller

javascript,angularjs,service,filter,locale

The controller is executed only once, not every time the scope updates. $filter('decorate')($scope.greeting) is evaluated when it is assigned to $scope.code, whereas {{greeting | decorate}} is evaluated every time the scope updates. If your filter is not marked as stateful, your filter expression {{greeting | decorate}} will only be evaluated...

Cakephp 3.0.0-RC2 I18n::locale() doesn't works

php,cakephp,internationalization,locale,cakephp-3.0

Because you redirect to another controller. Which mean locale can be override in that controller or AppController. Why don't you use session? public function login() { if ($this->request->is('post')) { $user = $this->Auth->identify(); if ($user) { $this->Auth->setUser($user); $this->request->session()->write('Config.language', 'du'); return $this->redirect($this->Auth->redirectUrl()); } $this->Flash->error(__("Nom d'utilisateur ou mot de passe incorrect, essayez à...

How to format the Spanish month in sentence case using SimpleDateFormat?

java,locale,simpledateformat

This is not a bug. SimpleDateFormat uses the month names and capitalization according to the local rules. In english months appers with first letter capitalized as in the English grammar rules this is mandatory. In spanish is not the same. Is mandatory to use the month names as lowercase. Java...

How do I set the locale for an ASP.NET 5 application?

c#,asp.net,locale,asp.net-5

The issue is with the async controller. You should set the default culture to all threads instead: app.Use(next => context => { CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en-AU"); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-AU"); return next(context); }); You can actually just put these lines at the top of the Configure method: CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en-AU"); CultureInfo.DefaultThreadCurrentUICulture =...

Laravel: Locale Session: Controller gets Parameter to change it but it cant. U have to hardcode it

session,laravel,locale

routes.php Route::get('/', '[email protected]'); Route::post('languagechooser', [ 'as' => 'languagechooser', 'uses' => '[email protected]' ]); view - welcome.blade.php <!-- I think this bit should help you out! --> <p> @if( Session::has('locale') ) Locale: {{ Session::get('locale') }} <br> Message: {{ Lang::get('test.message') }} @else no session locale set @endif </p> <form action="{!! route('languagechooser') !!}" method...

Windows Python: Changing encoding using the locale module

python,encoding,utf-8,locale,setlocale

Check this https://docs.moodle.org/dev/Table_of_locales I think in windows you need to set 'localewin' value instead of the locale name. Setting locale.setlocale( locale.LC_ALL, 'English_United States.1252' ) worked for me in windows. I also tried setting different locales Dutch_Netherlands.1252 and they worked. Though this might not solve your problem of UnicodeEncodeError, but I...

get current windows keyboard layout in Java

java,windows,locale,keyboard-layout

AFAIK you will have to write some JNI to get it. There are 2 functions of interest in Windows API : GetKeyboardLayout : will give a DWORD whose lower word identifies language and sublanguage -> to use if you just switch between a limited an known list of layouts GetKeyboardLayoutName...

.NET Application looking for DLLs in locale specific sub-folder

.net,dll,locale,app-config,subfolder

There is no mechanism in .NET that makes it look for assemblies that contain code in an "en-GB" subdirectory like that. It is only ever used for satellite assemblies, they don't contain code, only resources, and it is the ResourceManager class that does the probing. The only somewhat likely candidate...

Formatting number in European format with two decimals

javascript,formatting,locale,culture

When you use Number.toFixed() you obtain a string (not a number any more). For that reason, subsequent calls to .toLocaleString() launch the generic Object.toLocaleString() method that knows nothing about numbers, instead of the Number.toLocaleString() you want. Having a look at the documentation we can compose something like this (tested in...

Swift ISO-8601 date formatting with iOS7

ios,date,swift,locale

The problem is with your time zone offset, your date format is not proper for that. Use the following format, "yyyy-MM-dd'T'HH:mm:ssZZZZZ" ...

C# using same code page to encoding byte array into string has different results in US locale and Japan locale

c#,.net,encoding,locale,zlib

Actually I can avoid encoding part but pass the bytes array directly to the P\Invoke method. Just need to change the signature of the P\Invoke method to take byte[] instead string. But I still want to know why using same code page gives different results in different locale settings!...

Get wrong Date from parsing time string by SimpleDateFormat. (1 hour offset) [Android/Java]

java,android,timezone,locale,simpledateformat

From the Android issue Issue 158265. The Google engineer replied the answer as below. The Nexus 5 appears to not be able to update the RTC clock hardware. When the user (or the OS) changes the clock it is not persisted to the device hardware permanently. The next time the...

Setting Windows XP Embedded locale programmatically in C#

c#,windows,windows-xp,locale

You need to use an API. Check this one: [DllImport("kernel32.dll")] static extern bool SetLocaleInfo(uint Locale, uint LCType, string lpLCData); With this function from kernel32.dll you'll be able to set the locale of the system. The first parameter specifies what locale will the function use when interpreting the data of lpLCData....

Access VBA Dmin and Dmax on comma seperated decimals

vba,function,ms-access,access-vba,locale

This will work: UpperPower = DMin("Column2", "t_table", "Column2 >= " & Replace(RatedPower, ",", ".")) Since the first argument to Replace() must be a string, RatedPower is implicitly converted to a string using the local decimal separator (if non-integer) and no thousands separators. This code is foolproof, in that it works...

How to get the currency symbol for particular country using locale?

java,locale,currency

It says in the Currency specification: getSymbol() gets the symbol of this currency for the default locale. For example, for the US Dollar, the symbol is "$" if the default locale is the US, while for other locales it may be "US$". If no symbol can be determined, the ISO...

Locale error when adding a space after each character for a unicode file?

bash,unicode,utf-8,sed,locale

Assuming you have a UTF-8 locale set up correctly, you can use this Perl one-liner: perl -F'' -C -lane 'print join " ", @F' in.txt > out.txt The -a switch splits the input on the field separator, which has been set to an empty string, so each character is a...

quickly change Android system language

java,android,eclipse,user-interface,locale

I think this is what you might looking for!!! If you would like to have your own application you can try this app i just created for you here!!! Language Picker Widget The Java Code public class MainActivity extends Activity { private Button btn; @Override protected void onCreate(Bundle savedInstanceState) {...

ZF2, I18n and dynamic locale not working anymore after update

php,dynamic,zend-framework2,locale,zend-translate

Found the problem. You have to set translator with locale to the view helper: public function onBootstrap($events) { .... $viewRenderer = $events->getApplication()->getServiceManager()->get('ViewRenderer'); $plugIn = $viewRenderer->plugin('translate'); $plugIn->setTranslator($translator, __NAMESPACE__); ... } Otherwise the locale is taken from the config.global if set there (as in my case). No idea why it worked before...

Change language of the Terminal's output in linux

linux,locale

Assuming Bourne shell or its descendents, you can set the environment for a single command by prefixing it with variable assignments, e.g., LANG=ja_JP.UTF-8 /sbin/service cloudstack-usage status cloudstack-usage if the program is localized and you wanted messages in Japanese. To get POSIX (no translation), you would use LANG=C There are several...

Using locale in the $resource URL

angularjs,locale,ngresource

Just provide a function that returns your value (see documentation): $resource('/:localeId/...', { localeId: function () { return $locale.id; }, // ... }) ...

where Py_FileSystemDefaultEncoding is set in python source code

python,python-2.7,locale

Summary: sys.getfilesystemencoding() behaves as documented. The confusion is due to the difference between setlocale(LC_CTYPE, "") (user's preference) and the default C locale. The script always starts with the default C locale: >>> import locale >>> locale.nl_langinfo(locale.CODESET) 'ANSI_X3.4-1968' But getfilesystemencoding() uses user's locale: >>> import sys >>> sys.getfilesystemencoding() 'UTF-8' >>> locale.setlocale(locale.LC_CTYPE,...

Android - Dynamically change language

android,locale,dynamic-languages,android-configchanges

You could save your language configuration in the callback onSaveInstanceState, when the system re-create your activity because of rotation, reload the saved locale values. private static final String LANG = "lang"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { Configuration configuration = getResources().getConfiguration(); DisplayMetrics displayMetrics...

Sonata Admin locale change with admin user's locale

symfony2,user,admin,locale,sonata

You could extend the login success handler and set the user's locale in the session. For example: # app/config/config.yml services: login_success_handler: parent: security.authentication.success_handler class: MyVendor\MyBundle\LoginSuccessHandler UPDATE: Make sure to point to this listener in your security.yml: # app/config/security.yml security: firewalls: secured_area: pattern: ^/ anonymous: ~ form_login: login_path: login check_path: login_check...

How do I use Angular i18n for languages it doesn't appear to support?

javascript,angularjs,internationalization,locale,angular-translate

Angular supports i18n Standard for location | globalization | internationalization. When it comes to number,dates and so fort for names of days, months, etc. Angular relies on $locale service for example in the case of number the property NUMBER_FORMATS. Here is the list of locations currently supported by angular: http://cdnjs.com/libraries/angular-i18n/...

How to get weekends vs weekdays in Cocoa?

cocoa,locale,nsdateformatter,nscalendar

I finally got it. The mistake was in the locale identifier which should be en_AE instead of en_AR import UIKit let arabicLocale = NSLocale(localeIdentifier: "en_AE") let islamicTabularCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierIslamicTabular) islamicTabularCalendar?.locale = arabicLocale let islamicTabularFormatter = NSDateFormatter() islamicTabularFormatter.calendar = islamicTabularCalendar islamicTabularFormatter.dateStyle = NSDateFormatterStyle.FullStyle let gregorianCalendar = NSCalendar(calendarIdentifier:...

Django: How to upload file without UnicodeEncodeError on save()?

python,django,file-upload,locale,python-unicode

this url have information about, Django: How to upload file without UnicodeEncodeError on save()? an for me work this: import locale import sys def my_views(request): # before reload(sys) sys.setdefaultencoding("utf-8") ...

Symfony2 - Locale in unit tests

unit-testing,locale,symfony-2.1

I just found the problem myself. Using the windows command line, the locale "de_DE.utf8" couldn't be found. So setlocale() failed, the default locale was "en". Using linux shell everything worked like a charm. So be careful when using locales and windows......

“Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale.” on OSX

c,osx,gtk,locale

The issue here is that the environment variable LANG is not set, because I've mixed settings for Polish and English in the Language and Region section in System Preferences. Quoting @KenThomases who helped me a lot with this problem: There's not going to be any C library locale defined for...

Symfony Twig - get default _locale in twig

symfony2,path,twig,translation,locale

You need to use app.request.attributes: {{ path(app.request.get('_route'), {'_locale': app.request.attributes.get('_locale') }) }} If you have configuration in controller you need to set default value in function parameter: /** * @Route("/", name="coming_soon", options={"expose"=true}, requirements={"_locale" = "fr|en"}) */ public function indexAction($_locale = 'en') { ... } ...

How to find current QLocale in Qt/PyQt/PySide?

python,qt,pyqt,locale,pyside

The answer is to simply use: current_locale = QtCore.QLocale() This will resolve to the system locale, unless the default locale has been explicitly re-set using QLocale.setDefault(). So the normal procedure would be: if necessary, set the default locale immediately after the QApplication is created. After that, any time a QLocale...

How to parse “1,234.56” in Java as Double?

java,double,locale

1,234.56 is not French notation. (Something like 1.234,56 is). Change your locale to Locale.ENGLISH, Locale.US, or similar...

Where is the LANGUAGE environment variable set?

linux,environment-variables,locale,configuration-files,archlinux

I finally found out where LANGUAGE is set : It is set by KDE. I just used the KDE settings tools. But according to this link, I shouldn't use en_US.UTF-8 as a value, but something like "val1:val2:val3" : so if I want to set it with my .zshrc file, I...

How to get date and time formatted using the device locale language?

android,locale,simpledateformat

If you want to convert a java.util.Date into a string, you might use the SimpleDateFormat class. The second constructor of this class takes an argument of the type Locale. With Locale.getDefault() you can get the default locale of the device, if it is not set or found it will give...

How do I get current application locale?

ios,objective-c,localization,locale,nslocale

The selected answer returns the current device language, but not the actual language used in the app. If you don't provide a localization for the preferred language in your app NSString *language = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0] NSLocale *locale = [NSLocale currentLocale]; NSString *countryCode = [locale objectForKey: NSLocaleCountryCode]; NSLocale *usLocale...

Python parsing date and find the correct locale_setting

python,datetime,internationalization,locale,datetime-parsing

To parse localized date/time string using ICU date/time format: #!/usr/bin/env python # -*- coding: utf-8 -*- from datetime import datetime import icu # PyICU import pytz # $ pip install pytz tz = icu.ICUtzinfo.getDefault() # any ICU timezone will do here df = icu.DateFormat.createDateTimeInstance(icu.DateFormat.MEDIUM, icu.DateFormat.MEDIUM, icu.Locale.getFrench()) df.setTimeZone(tz.timezone) ts = df.parse(u'3...

Codecvt doesn't work in gcc

c++,g++,locale,codecvt

Only file streams are required to use std::codecvt<...> and there is no requirement that any of the standard stream objects is implemented in terms of file streams. There are reasons for the implementers of either choice. Dinkumware's implementation uses <stdio.h> for most of its operations and it makes sense to...

How to change the library locale as well when I change the app locale in android

android,localization,locale,android-support-library,android-location

My code for changing languages. It works for me: change locale for all the app. public static void applyLanguage(Context context) { Configuration config = context.getResources().getConfiguration(); if (!"".equals(languageCode) && !config.locale.getLanguage().equals(languageCode)) { Locale locale = new Locale(languageCode); Locale.setDefault(locale); config.locale = locale; context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics()); } } The languageCode is your lang variable...

c++ Lithuanian language, how to get more than ascii

c++,character-encoding,locale

In Windows use wide character strings (1UTF-16 encoding, wchar_t type) for internal text handling, and preferably UTF-8 for external text files and networking. Note that Visual C++ will translate narrow text literals from the source encoding to Windows ANSI, which is a platform-dependent usually single-byte encoding (you can check which...

Converting a number from a string to an int with decimals separated by comma or dot

c#,.net,xaml,numbers,locale

Maybe safest bet would be to try parse input with both cultures, something like this: private static int ConvertStringValue(string value) { decimal valDouble; var comma = (NumberFormatInfo)CultureInfo.InstalledUICulture.NumberFormat.Clone(); comma.NumberDecimalSeparator = ","; comma.NumberGroupSeparator = "."; var dot = (NumberFormatInfo)CultureInfo.InstalledUICulture.NumberFormat.Clone(); dot.NumberDecimalSeparator = "."; dot.NumberGroupSeparator = "."; if (decimal.TryParse(value, NumberStyles.Currency, comma, out valDouble)) {...

Switching language (locale) in ActiveAdmin without passing a parameter

ruby-on-rails-4,locale,activeadmin,rails-i18n

Ok so I've finally figured out what was going on. I originally followed the rails guide and set my routes.rb: # config/routes.rb scope "/:locale" do resources :books end which resulted in an error like: No route matches {:action=>"index", :controller=>"admin/users"} missing required keys: [:locale] this was "fixed" by setting scope ':locale',...

Get dates from AUT?

date,vbscript,locale,qtp,hp-uft

Not sure about QTP, but the windows scripting host handles it via SetLocale Option Explicit Dim originalLocale originalLocale = GetLocale() Dim aLocales aLocales = Array("en-us", "es-es", "de") Dim locale, aDates, d For Each locale in aLocales WScript.Echo locale SetLocale locale aDates = Array( Date(), DateValue("01/02/2015")) For Each d in aDates...

App not finding resources after locale change in Android

android,crash,resources,locale

This error: Caused by: android.content.res.Resources$NotFoundException: String array resource ID #0x7f08001e at android.content.res.Resources.getStringArray(Resources.java:451) at com.flavorburst.mcdonalds.NavigationDrawerFragment refers to a string array that you have defined in one of your XML files, but you forgot to create the string array value in /values/array.xml. For example, in one of your XML files, you may...

Is there a locale code for informal German (de_DE-informal?)

wordpress,localization,locale,transifex

Generally Gettext uses @ to distinguish language variants. So in this case it could be [email protected] This way the locale will be correctly handled by Gettext with fallback to de_DE (in contrast with suggested de_DE-x-informal which will not fall back this way as Gettext will see DE-x-informal as country code)....

Isabelle: locale interpration about record fails in proof

locale,record,isabelle,interpretation

The commands interpretation and interpret only register those facts from locales that are not already in scope from previous interpretations. The ring locale is a sub-locale of comm_group with the prefix add and precisely the parameter instantiation you are giving in the first interpretation. Since all these facts are already...