internationalization

How can the cache for the views with translations be invalidated?

坚强是说给别人听的谎言 提交于 2019-12-05 11:13:16
问题 Imagine you have two views with code like the following: controller_a/a.html.erb <%= content_tag(:div) do %> <%= I18n.t "some.key" %> <% end %> controller_b/b.html.erb <%= content_tag(:div) do %> <%= I18n.t "some.key" %> <% end %> <%= content_tag(:div) do %> <%= I18n.t "some.other_key" %> <% end %> So, a.html.erb is on controller_a#a, while b.html.erb is on controller_b#b. Both actions are cached by caches_action . How can I make sure that when I change the some.key translation key, both

Customizing java.text formatters for different Locales

可紊 提交于 2019-12-05 10:48:30
Building a java application that supports different Locales, but would like to customize the DateFormat display beyond what is available between FULL , LONG , MEDIUM , and SHORT DateFormat options. Would like to do things like place a character between the date and time components of a DateFormat.getDateTimeFormat() , lowercase the AM/PM, etc, at least for english. can think of 3 ways to do it: 1) if locale is english, use my custom format string on a new SimpleDateFormat object. 2) modify the default format strings for existing locales 3) create a new locale variant that specifies the format

JSF Internationalization f:loadbundle or through faces-config: Performance point

拈花ヽ惹草 提交于 2019-12-05 10:37:40
There are two ways to load the properties file into JSF 2.0. Global Resource Bundle To load the properties file globally, so that all the jsf pages can access the messages. You can create a “faces-config.xml” file and declare the properties file explicitly. faces-config.xml <?xml version="1.0" encoding="UTF-8"?> <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <application> <resource-bundle> <base-name>com

UITextInputMode currentInputMode is deprecated. Suggested replacement?

梦想的初衷 提交于 2019-12-05 10:37:40
In our app, we'd like to detect the current keyboard language. For example, if the user sets up multiple language keyboards under Settings->General->Keyboard->Keyboards, we'd like to know what language they're typing in and to get a notification from NSNotificationCenter when this changes. - (void)viewDidLoad { [super viewDidLoad]; NSNotificationCenter *nCenter = [NSNotificationCenter defaultCenter]; [nCenter addObserver:self selector:@selector(languageChanged:) name:UITextInputCurrentInputModeDidChangeNotification object:nil]; [self languageChanged:nil]; } -(void)languageChanged:

Django makemessages not working for JS files

三世轮回 提交于 2019-12-05 10:13:58
My setup settings.py INSTALLED_APPS = ( ... 'myprojectname', ... ) STATIC_ROOT = '/var/www/a_valid_path/' LOCALE_PATHS = ( os.path.join(BASE_DIR, "locale"), ) urls.py js_info_dict = { 'domain': 'djangojs', 'packages': ('myprojectname',), } urlpatterns = patterns('', ... url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), ... ) My project structure is as follows: |- projectname |--- app1 |--- app2 |--- manage.py |- virtualenv |- static |--- js |--- css I also have the locale folder in the root folder of my project, where manage.py is located. What I'm doing Simply running:

Django translations and gettext: The deprecation of the % (string interpolation) operator

烂漫一生 提交于 2019-12-05 10:02:57
Although Django Django does not yet support Python 3, it eventually will, so I want to keep my code the more "future-proof" possible. Since Python 2.7 the string interpolation operator ( % ) is being deprecated. And I realized that every string that needs to be translated is using the % interpolation syntax. And in the Django docs there is no mention of the new str.format method (the "new" official way of string formatting)... Maybe there is a limitation of the gettext library, but I don't think so, since the string appears identical in the .PO files. The question is if I can use the new

(鉑) string functions and UTF8 in php

痞子三分冷 提交于 2019-12-05 09:35:54
Why is the output of the following statement 3 and not 1? echo mb_strlen("鉑"); Thing is that echo "鉑"; will properly output this sign which is encoded as UTF-8. Make sure you set the proper internal encoding: <?php echo mb_internal_encoding() . '<br />'; echo mb_strlen('鉑', 'utf-8') . '<br />'; echo mb_strlen('鉑') . '<br />'; mb_internal_encoding('utf-8'); echo mb_internal_encoding() . '<br />'; echo mb_strlen('鉑') . '<br />'; // ISO-8859-1 // 1 // 3 // UTF-8 // 1 You will likeliy need to add the character set: echo mb_strlen("鉑","utf-8"); Set the encoding to your mb_strlen function: echo mb

Should perl's File::Glob always be post-filtered through utf8::decode?

只谈情不闲聊 提交于 2019-12-05 09:34:12
The output of the following minimal example shows that (on my linux machine) File::Glob seems to have the unexpected side-effect of converting a utf8 string to non-utf8: #!/usr/bin/perl use utf8; use strict; my $x = "påminnelser"; my $y = glob $x; print "x=",utf8::is_utf8($x),"=\n"; print "y=",utf8::is_utf8($y),"=\n"; This is causing wrong behavior in my program. On linux, it looks like I can fix it by applying utf8::decode() after File::Glob. Is this the right way to fix this? Is this a bug in File::Glob? Will my fix produce correct results on other systems such as Windows? Encoding handling

Java Swing - switch locale dynamically at runtime

做~自己de王妃 提交于 2019-12-05 09:32:00
I understand how to internationalize a java program, but I have a problem. Language in my program can be switched anytime, but my program can exist in many states, which means that it may or may not have several JLabels, JPanels, JFrames, etc, open. Is there a class or a method which will update the current GUI to the switched language, or does it have to be done manually? If nothing else works, I'll just require user to restart the program to switch the language, but runtime change would be nice... The solution generally used is to have a hash of user-facing strings in a central manager class

Module Localization in DNN

依然范特西╮ 提交于 2019-12-05 09:13:20
I don't know much about the localization process in DNN. The question is that how can you localize a new module? Is it possible to include localization files with every module separately? What solutions can you come up with? karbonphyber Localization of a module is pretty easy thanks to DotNetNuke. Wherever your .ascx (View) file is, the App_LocalResources folder should always accompany it, on the same level. There should also be a corresponding .ascx.resx file in that folder. view.ascx App_LocalResources - view.ascx.resx Once you have that structure in your module. DNN will pick the file up