locale

angular 5 change locale dynamically for i18n

北战南征 提交于 2020-01-03 08:42:15
问题 I am trying to change locale dynamically to change i18n language. I have two files, the one with english values and the other one with french values. What I've tried for now is something like that : ngOnInit() { const localeName = localStorage.getItem('locale') || 'fr'; import(`@angular/common/locales/${localeName}.js`).then(locale => { registerLocaleData(locale.default); }); } but it gave me the following error : error TS1323: Dynamic import cannot be used when targeting ECMAScript 2015

Dynamically change android soft keyboard language setting?

这一生的挚爱 提交于 2020-01-03 04:16:05
问题 I have some edit boxes in my app, some of them I will input English text, some of them I will input Spanish. I'm using the standard android soft keyboard, however as my device locale is set to English, when I type Spanish in one of my "Spanish" edit boxes, the English corrective text/predictive text makes this difficult. The only workaround I've found, is to go into the device settings and change the language over, but this is quite annoying. Is there anyway I could have some kind of button,

Load different strings.xml resource on Spinner change

一曲冷凌霜 提交于 2020-01-03 04:15:33
问题 I am am trying to change the language of my activity (just the activity not the whole app) when a new item is selected within a spinner. The spinner contains Text representing the language I would like to switch through (French, English etc.) In my res folder I have separate strings.xml for each language in the correct folders i.e. values-fr for French. How can I, on the changing of the spinner item, load from the correct strings.xml which corresponds? @Override public void onCreate(Bundle

Load different strings.xml resource on Spinner change

可紊 提交于 2020-01-03 04:15:02
问题 I am am trying to change the language of my activity (just the activity not the whole app) when a new item is selected within a spinner. The spinner contains Text representing the language I would like to switch through (French, English etc.) In my res folder I have separate strings.xml for each language in the correct folders i.e. values-fr for French. How can I, on the changing of the spinner item, load from the correct strings.xml which corresponds? @Override public void onCreate(Bundle

locale in laravel 5.4 returns to the pervious locale after refresh

好久不见. 提交于 2020-01-03 03:35:08
问题 im learning the multi locale inn laravel 5.4 so i created two files first one in resources/lang/es/greeting.php <?php return [ 'hello' => 'hola', ]; and second in resources/lang/en/greeting.php <?php return [ 'hello' => 'hola', ]; and i created this route inside web.php Route::get('/{locale}', function ($locale) { App::setLocale($locale); return view('index'); }); so when i request this link (localhost:8000/es) it works but when i refresh the page its returns to default locale which is en and

Grails Locale not set for Spock unit tests

依然范特西╮ 提交于 2020-01-02 18:36:20
问题 In my Grails 2.2 application I make some calculations which requires Locale to be set correctly. Therefore I provide this configuration block in my application, as mentioned elsewhere. grails-app/config/spring/resources.groovy : beans = { localeResolver(org.springframework.web.servlet.i18n.SessionLocaleResolver) { defaultLocale = new Locale("da","DK") java.util.Locale.setDefault(defaultLocale) } } Now, as also suggested by other questions and answers, this works in my context for the running

How to change the language of android app from within?

巧了我就是萌 提交于 2020-01-02 11:19:28
问题 I am developing a comic app.I have three radio buttons which are english,french and spanish respectively. And when the user clicks on any one of them the strings.xml from values-es,values-fr and values-en should change the string of the required references but and i click on the radio buttons it does not change the references are still in engish and do not change to french or spanish 回答1: I am not sure this answer will help you out. But the pinch of code will change the locale pragmatically.

PHP Silex routing localization

青春壹個敷衍的年華 提交于 2020-01-02 06:47:07
问题 starting with Silex. Say I want a localised site where all routes have to start with /{_locale} and don't fancy repeating myself as : $app->match('/{_locale}/foo', function() use ($app) { return $app['twig']->render('foo.twig'); }) ->assert('_locale', implode('|', $app['languages.available'])) ->value('_locale', $app['locale.default']) ->bind('foo'); $app->match('/{_locale}/bar', function() use ($app) { return $app['twig']->render('bar.twig'); }) ->assert('_locale', implode('|', $app[

The chosen LC_CTYPE setting requires encoding “LATIN1”

妖精的绣舞 提交于 2020-01-02 05:14:41
问题 I'm trying to create a database in PostgreSQL 9.4 CREATE DATABASE "dbname" WITH ENCODING 'UTF8'; but getting ERROR: encoding "UTF8" does not match locale "en_US" DETAIL: The chosen LC_CTYPE setting requires encoding "LATIN1". error. PostgreSQL is on a vagrant box and I'm connecting to this db server over SSH tunneling. Vagrant box's locale settings : root@precise32:/vagrant# locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC

The chosen LC_CTYPE setting requires encoding “LATIN1”

回眸只為那壹抹淺笑 提交于 2020-01-02 05:14:02
问题 I'm trying to create a database in PostgreSQL 9.4 CREATE DATABASE "dbname" WITH ENCODING 'UTF8'; but getting ERROR: encoding "UTF8" does not match locale "en_US" DETAIL: The chosen LC_CTYPE setting requires encoding "LATIN1". error. PostgreSQL is on a vagrant box and I'm connecting to this db server over SSH tunneling. Vagrant box's locale settings : root@precise32:/vagrant# locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC