w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to change the locale for testing
You don't need to change the settings on your computer, you can set the locale for the app to run in instead. You can create a scheme in Xcode for Thai And then, in the scheme options go to Edit. Then, go to the run section and the arguments, You can then pass in the arguments for thai except in your case you need to put the Thai localisation code in place of es. There is more detail in this blog post

Categories : Iphone

Localization testing on Android - Change Application or System locale
As far as I could notice, changing the application or the system Locale is not different with a side note that one would have to refresh the views. I've wrote a post about my experience with Multi-Languages... leave your comments at the bottom.

Categories : Android

Boost.Locale testing for particular backend
Boost.Locale provides this: std::vector<std::string> boost::locale::localization_backend_manager::get_all_backends() const This will list all the backends available. E.g., localization_backend_manager lbm = localization_backend_manager::global(); auto s = lbm.get_all_backends(); for_each(s.begin(), s.end(), [](string& x){ cout << x << endl; }); will print icu winapi std If Boost.Locale wasn't built with ICU support, it will list only the two last lines. You can use this in a configure script and compile a .cpp that accepts a backend as a parameter and checks whether it is supported.

Categories : C++

SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates
To remove the warning just add Locale.getDefault() as the second argument while instantiating the date format object. Eg. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", java.util.Locale.getDefault());

Categories : Android

Jquery datepicker and Spring Locale. Change datepicker language with locale language. How to?
I used this code snippet in a project once. Hope it helps: $(function() { calendar(); }); function calendar(){ //omitted datepicker init $(".calendar").datepicker("option", $.datepicker.regional["<%=locale%>"]); } All date field's css attributes are specified as calender and locale is retrieve in java code. I'm not familiar with CookieLocaleResolver, I used SessionLocalResolver but there should be equivalent way to get the Locale. public static Locale getLocaleFrom(HttpSession session) { return (Locale) session .getAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME); } And I remember we modified the datepicker for different locale values between Java and datepicker. You could use a mapping mechanism as an alternative solution.

Categories : Javascript

Can an app change its name and UI for one locale only?
Whta's the minimal set of action I can take to get there as fast as I can? In terms of the app itself: Step #1: Find out how you are setting the name in the app. Frequently, that's via an @string/app_name resource, as the android:name in <application> (and perhaps also in one or more <activity> elements) in the manifest. Step #2: Create alternative versions of that string resource for other languages.

Categories : Android

Change web app locale with url routing
I solved in this way: ../config/autoload/local.php $_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $segment = explode('/', $_SERVER['REQUEST_URI_PATH']); $locale = $segment[1]; if($locale == '') $locale = 'en_US'; // default locale return array( 'translator' => array( 'locale' => $locale, ), );

Categories : PHP

change locale symfony 2.3
Based on this and this answers. LanguageListener.php: <?php namespace AcmeUserBundleEventListener; use SymfonyComponentHttpFoundationSessionSession; use SymfonyComponentSecurityHttpEventInteractiveLoginEvent; use SymfonyComponentHttpKernelEventGetResponseEvent; use SymfonyComponentHttpKernelHttpKernelInterface; class LanguageListener { private $session; public function setSession(Session $session) { $this->session = $session; } public function setLocale(GetResponseEvent $event) { if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { return; } $request = $event->getRequest(); $request->setLocale($request->getPreferredLanguage(array('en', 'de'))); } } services.yml: a

Categories : PHP

Change Locale in MVC application on click
Setting the culture is only valid until the thread terminates, which happens after all page processing has finished. In this case, after you issue the redirect the server will send the Location HTTP header to the new address and close the response. The browser will then initiate a new request to the new location and the value you set in Thread.CurrentThread.CurrentCulture will reset to the default one. You have to persist the language selection (session, cookie...) and then apply it at start of your page logic.

Categories : Asp Net Mvc

How to change the locale of a formatted date?
It's not very difficult... Sub VBA_Dates_Format() Cells.Clear Range("A1").Value = Now Range("A2").Value = Now ' Polish Range("A1").NumberFormat = "[$-415]d mmm yy;@" ' English UK Range("A2").NumberFormat = "[$-809]d mmm yy;@" End Sub I have achieved this by recording and modifying a macro to fit the criteria. Further reading available here

Categories : Vba

Android: Change to unsupported locale
Since there are 2 distinct standards, you have to double your values folder. Add your Hebrew strings to these folders: values-he and values-iw Some devices will use one folder. Other devices will use the other one. Note that he is actually deprecated. So, most devices will use iw

Categories : Android

Custom change of NumberFormat for (Dutch) locale
Yes, this explains the problem pretty well (discrepancy between CLDR - used by Java - and official Dutch language recommendation). To use a different format than the CLDR one you have to define it yourself, using the default format for positive values and a different one for negative numbers: ((DecimalFormat)NumberFormat.getCurrencyInstance(new Locale("NL", "nl"))).applyPattern("¤ #,##0.00;¤ -#").format(-200); (how you decompose this, where you apply the pattern etc will of course depend on your existing code) ¤ #,##0.00 is the current default Dutch pattern for positive values, ¤ -# is the new pattern for negative values which means "currency symbol first, then a non-breaking space (i.e. u00a0, not the regular SPC character), then negative symbol, then same format as positive

Categories : Java

Spring security: change locale on login
Rather than making a custom AuthenticationSuccessHandler set the locale, why not implement an custom LocaleResolver that resolves the locale from the UserDetails object (using SecurityContextHolder.getContext().getAuthentication() to get the authentication object)?

Categories : Spring

spree.i18n don't change the default locale
The easiest way to implement localization in Spree is to include the spree_i18n gem. Follow the instructions listed there, and set your locale in config/application.rb as you have done. You shouldn't need to copy any of the locale files to your local repository.

Categories : Ruby On Rails

Unable to change the Locale on a Glassfish v3 J2EE app
According to the Javadoc for Locale.getDefault(), you can change the default locale by using Locale.setDefault(Locale). Obviously, it isn't very nice to hard-code a locale in your app, so you could consider reading it from a config file or JVM option.

Categories : Java

Validation/conversion errors of do not localize to , but to default locale
I can reproduce your problem. Both Mojarra 2.1.25 and MyFaces 2.1.12 expose the same problem. I'm therefore not sure if this is a bug in the JSF impl or an oversight in the JSF spec. So far, it turns out that the viewroot locale is not been set for a GET request before the render response phase is entered. The converter runs during validations phase, far before render response, that explains why it got the default locale instead. I have to investigate it later on and if necessary report an issue to Mojarra. In the meanwhile, your best bet to solve this problem is to obtain the bundle as follows instead of EL-evaluating the <resource-bundle><var>: String basename = "com.example.i18n.message"; // Exactly the same as <resource-bundle><base-name> Locale locale = conte

Categories : Validation

Change locale for JUnit tests via Spring context
One way to achieve this would be to add a test lifecycle hook that is fired before your suite is executed. test.beforeSuite { TestDescriptor suite -> System.setProperty('user.language', 'en') }

Categories : Spring

Android: How to get string in specific locale WITHOUT changing the current locale
You can save all the strings of the default locale in a Map inside a global class, like Application that is executed when launching the app: public class DualLocaleApplication extends Application { private static Map<Integer, String> defaultLocaleString; public void onCreate() { super.onCreate(); Resources currentResources = getResources(); AssetManager assets = currentResources.getAssets(); DisplayMetrics metrics = currentResources.getDisplayMetrics(); Configuration config = new Configuration( currentResources.getConfiguration()); config.locale = Locale.ENGLISH; new Resources(assets, metrics, config); defaultLocaleString = new HashMap<Integer, String>(); Class<?> stringRes

Categories : Android

Setting the gettext locale independent of system locale
You are using LC_MESSAGES what means ' for system responses (available if PHP was compiled with libintl)' I would try to ignore this option, for example setlocale(LC_ALL ^ LC_MESSAGES, $locale). http://www.php.net/manual/en/function.setlocale.php

Categories : PHP

Why doesn't getConfiguraton().locale match locale.US?
You need to use the equals() method. The == and != operators won't work for this. Locale locale = getResources().getConfiguration().locale; if(!locale.equals(Locale.US)) { Log.i("ActivityDownloader", "Locale: " + locale.toString() + ", (" + Locale.US.toString() + ")"); } I believe this is because == and != will compare references rather than the value. See http://stackoverflow.com/a/767379/935779

Categories : Android

Maven default locale not same with OS locale
You can use this command set MAVEN_OPTS= -Duser.language=tr Anyway the best solution is to put these informations in the POM file and never by command line. In particular you have to deal with the configuration of Maven-Surefire-Plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.9</version> <configuration> <systemPropertyVariables> <user.language>tr</user.language> <user.region>TR</user.region> </systemPropertyVariables> </configuration> </plugin> Second Question: Another question if I may, I am running a web app in my l

Categories : Java

App's locale files affect Engine's locale files. It force to have the same files in the hosting app. How fix it?
So I figured out where was the problem. I my engine's engine.rb file I had such a code for initialization. The problem was with receiver of config. Since I provide an app instance to the block, the receiver of config is app. And that caused the problem: initializer("my_engine.locales") do |app| tracking_logger = Logger.new(app.root.join('log', "my_engine_log.log"), 10, 30*1024*1024) config.i18n.load_path += Dir[root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :ru config.i18n.fallbacks = [:en] tracking_logger.debug "MyEngine::Engine specific locale settings are set. Def locale == :ru " end So I changed the receiver to MyEngine and now everything works just fine: initializer("my_engine.locales") do |app| tracking_logger = Logger.new(app.root.join(

Categories : Ruby On Rails

Change Django Authentication Backend for Testing
Create an alternative settings file, for example myproj/test_settings.py, and specify that settings file when running unit tests. Write the alternative settings file like this: from myproj.settings import * AUTHENTICATION_BACKENDS = ( #'your.ldap.backend', 'django.contrib.auth.backends.ModelBackend', ) That is, the settings inherits everything from your regular settings, but overrides the AUTHENTICATION_BACKENDS definition, with your LDAP backend commented out. Then, run your tests like this: python manage.py test --settings=myproj.test_settings

Categories : Django

Changing an application's locale without changing the Windows locale
If new threads don't use the same locale you can start them like this: Thread theNewThread = new Thread(() => { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); //Make something else }); theNewThread.Start(); Or in other way; public static void Start(this Thread thread, CultureInfo cu) { //Set the CU here.. thread.Start(); } Didn't tried this but I gess it could work

Categories : C#

Entity Framework 5 - How to change connection string for unit testing?
I alway s use a separate unit test project with an App.config of its own. The connection string has the same name as in the main app but the database connection is different. When you run unit test, e.g. from within Visual Studio, in the background a unit test runner is executed that is nothing but a regular application with its own configuration, the app.config. You can start and dispose contexts for each test. Most unit test frameworks have attributes to mark methods as setup/teardown fixtures that can either run per test fixture or per test. You could initialize an IoC container in a test fixture setup ([TestFixtureSetUp] in NUnit) and a context in a test setup ([SetUp] in NUnit). For some scenarios we use scripts to ensure and restore database state, but for most test we start a Tra

Categories : Wcf

Is there any testing tool/framework for unit testing of Oracle ADF bounded task flow?
What sort of testing are you looking to undertake? Functional, stress/load? Looks to Selenium or Oracle Application Test Suite (OATS) for functional. Look to OATS or Apache JMeter as options for stress/load. The advantage of OATS over other options is it has intelligence built in to understand the ADF framework.

Categories : Unit Testing

Can I use SOAPUI testing tool for automated testing of a purely web-based application?
I would question as to why you want to use soapUI for web UI testing? For web UI testing i would recommend using some other tool like selenium. As clarified in my comment below, it would seem that you can make soapUI and Selenium work together. See http://learnsoapui.wordpress.com/2012/09/27/selenium-soapui-can-they-work-together/ for details.

Categories : Testing

Unit-testing and Integration Testing for Large or Medium-Complexity System Models in SIMULINK
I would look into Simulink Design Verifier and Simulink Verification&Validation. Specifically, they offer features such as automated test generation and coverage analysis, which I think are applicable to your problem. As a side note... With regards to the matlab unit-testing framework which you mentioned in your post, this is basically a MATLAB implementation of the xUnit framework. So it obviously comes in handy if you want to be able to apply xUnit design patterns to tests of MATLAB code. The framework can be used to write tests for a Simulink model, but keep in mind that you have to be able to write the tests in MATLAB code. So this just means making use of the Simulink command-line interface (e.g. commands like set_param and sim) to setup and exercise your model, then use th

Categories : Unit Testing

When and why should I switch from functional Selenium testing to unit testing in a Django web app?
I'm using both selenium and unit tests right now, and here are some of my thoughts: Unit test run faster than selenium scenario tests. Unit tests are easier to write then selenium scenario tests. Unit tests are much more granular than selenium scenario tests. Unit tests are less brittle than selenium scenario tests. My selenium tests tend to run in a matter of minutes (they are several pages long) as compared to unit tests which are designed to run in less than a second. I have to spend a lot of time setting up the environment for a specific selenium test and then run it, and then check that the entire environment is in the right state. To test even a slightly different scenario, say, what happens if someone enters a bad value for one field, I have to start over from scratch. Unit tes

Categories : Django

Testing (not unit testing) private method correctness
This is the academia approach for all first year classes at the University of Waterloo, I imagine a similar approach is taken in the real world (my first co-op is 2014 so I don't know just yet). I find it very useful but it takes some time. If you create a class (henceforth mentioned as a module) then you need you create an associative driver module for each class. This driver file will consist of all your tests: testing edge cases and expected input to ensure your function(s) from your module behave as expected. Each driver module will have a main method and for your testing you will need to change the scope of your function from private to public (or call them all in the constructor). Keep in mind we are programming in C and driver modules are much easier to make without changing scope

Categories : C#

Unit testing - implementing equals only to facilitate testing
Uniutils has a perfect reflection equals method you can use for unit testing. This way your production code remains clear from all this test stuff. public class User { private long id; private String first; private String last; public User(long id, String first, String last) { this.id = id; this.first = first; this.last = last; } } Later in test: User user1 = new User(1, "John", "Doe"); User user2 = new User(1, "John", "Doe"); assertReflectionEquals(user1, user2); If you're using Mockito it has it's own means to do the same thing: Mockito.verify(userDeleter).delete(Mockito.refEq(user));

Categories : Java

Preparing an automated testing using javascript for testing a module
Note: This question is targeted towards nodejs module testing in general, not Arrow. I don't want to delete it as the author is looking for clarification of some things in the comments of my anwser. I will be happy to delete this anwser if it is requested. I would reccomend mocha http://visionmedia.github.io/mocha/. It is a great testing framework that is very popular. When combined with the module should, you can write simple tests, like this. require('should'); describe('Array', function(){ describe('#indexOf()', function(done){ it('should return -1 when the value is not present', function(){ [1,2,3].indexOf(5).should.equal(-1); [1,2,3].indexOf(0).should.equal(-1); done(); }) }) }) You can then set up a free web service called travis ci https://travis-c

Categories : Javascript

Testing ASP.NET Web API POST and Parameterless GET Routes with WebApiContrib.Testing
There seems to be some nasty issues here - after debugging through the WebApiContrib.Testing library, I've found the following... In the route mapping code used for the libraries own tests, the route mappings look like this... // GET /api/{resource} routes.MapHttpRoute( name: "Web API Get All", routeTemplate: "api/{controller}", defaults: new {action = "Get"}, constraints: new {httpMethod = new HttpMethodConstraint("GET")} ); My route mapping looks like this for essentially the same route... config.Routes.MapHttpRoute("DefaultApiGet", "{controller}", new { action = "Get" }, new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }); Notice the different syntax for constraint buildin

Categories : Asp Net

What is sanity testing? And what is its advantage in mobile testing
In mobile terms: In mobile applications there are following types of testing: 1) Sanity test 2) Feature test 3) Defect verification 4) Regression test 5) Hopper test Sanity test - It is a rapid testing of features to check the basic features and stability. Testing basically boils down in finding fall/not fall and if there are no rough errors. Sanity check is a very basic check to see if all software components compile with each other without a problem. It can be done by developers. This is just to make sure that developers have not defined conflicting or multiple functions or global variable definitions. Sanity test is usually unscripted. Sanity testing helps to identify the dependent missing objects. Sanity test is used to determine a small section of the application is stil

Categories : Testing

ember.js unit testing and integration testing
To run the test from just one JS file, specify the file name in the "files" array of your karma config file. Here's a sample config file I used recently. My example runs 2 js files for the test portion (the last 2 in the list), but you could easily just do one. Bryan

Categories : Ember Js

Testing for CLSCompliance (or testing for any attribute)
How do I test an item for CLSCompliant true / false? You get the relevant FieldInfo using Type.GetField, and then use MemberInfo.IsDefined. Sample code: using System; using System.ComponentModel; using System.Globalization; public enum DemoEnum { Foo, Bar, [Description("This is a baz")] Baz } class Test { static void Main() { foreach (var name in Enum.GetNames(typeof(DemoEnum))) { var field = typeof(DemoEnum).GetField(name); Console.WriteLine("{0}: {1}", name, field.IsDefined(typeof(DescriptionAttribute), false)); } } } If you need the actual attribute value, you'd need to use MemberInfo.GetCustomAttributes instead.

Categories : C#

How to get the LCID from std::locale
The only identifying entity associated with a std::locale() is its `name(): std::cout << l1.name() << ' '; The content of this attribute is rather weakly specified but in the above setup it should have a name and yield something different from "*" which is what is returned for unnamed locales. What the name is, isn't specified, however.

Categories : C++

Passing the locale value in URL
This code is not a beauty, but you could try FacesContext ctx = FacesContext.getCurrentInstance(); String contxRoot = ctx.getExternalContext().getRequestContextPath(); String initialUri = ((HttpServletRequest) ctx.getExternalContext().getRequest()).getRequestURI(); String languageParameter = "?language="+this.selectedLaguage; try { FacesContext.getCurrentInstance().getExternalContext().redirect(contxRoot+initialUri+languageParameter); } catch (IOException e) { e.printStackTrace(); }

Categories : JSF

locale can't be changed
Primefaces library doesn't provide German translation for its components. You need to download the javascript piece and attach it to your code. Then, make the calendar use the locale you want. Take a look at this site and here you have more info about your issue. You also are including a Javascript file depending on your locale (<h:outputScript library="scripts" name="#{dateBean.locale}.js">) that makes the javascript file to be included dinamically depending on your locale. Since you're only refreshing the h:form part with your ajax request, you could get in trouble with that, since this tag is rendered with the whole view, so your translation file is not available for your locale at the moment. Appropiate solution: just include all the javascript files you need since the begining.

Categories : JSF

Set Locale - Russian
setlocale() affects a lot of things you should answer yourself if these things covers your needs. It has two params setlocale ( int $category , array $locale ) $ategory can be(from manual) set to one of these constants: LC_ALL for all of the below LC_COLLATE for string comparison, see strcoll() LC_CTYPE for character classification and conversion, for example strtoupper() LC_MONETARY for localeconv() LC_NUMERIC for decimal separator (See also localeconv()) LC_TIME for date and time formatting with strftime() LC_MESSAGES for system responses (available if PHP was compiled with libintl) Also look at this quote from manual: Returns the new current locale, or FALSE if the locale functionality is not implemented on your platform, the specified locale does not exist or the category nam

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.