internationalization

Translating %% with gettext and jinja2 and pyramid

六月ゝ 毕业季﹏ 提交于 2019-12-06 07:21:29
Doing i18n work with Python using Jinja2 and Pyramid. Seems to have a problem knowing how it should translate %%. I'm beginning to suspect the bug is in Jinja2. So I've done some more investigation and it appears the problem is more with gettext than with jinja2 as illustrated with the repl >>>gettext.gettext("98%% off %s sale") % ('holiday') '98% off holiday sale' >>>gettext.gettext("98%% off sale") '98%% off sale' >>>gettext.gettext("98% off %s sale") % ('holiday') Traceback (most recent call last): Python Shell, prompt 13, line 1 TypeError: %o format: a number is required, not str It seems

Python: date formatted with %x (locale) is not as expected

青春壹個敷衍的年華 提交于 2019-12-06 06:39:31
问题 I have a datetime object, for which I want to create a date string according to the OS locale settings (as specified e.g. in Windows'7 region and language settings). Following Python's datetime formatting documentation, I used the %x format code which is supposed to output " Locale’s appropriate date representation. ". I expect this "representation" to be either Windows "short date" or "Long date" format, but it isn't either one. (I have the short date format set to d/MM/yyyy and the long

How to localize a Rails plugin?

南楼画角 提交于 2019-12-06 06:13:26
I'd like to translate the OpenIdAuthentication plugin into another language but I'd like not to change the plugin directly. Here's the basic structure of the messages I want to translate: module OpenIdAuthentication class Result ERROR_MESSAGES = { :missing => "Sorry, the OpenID server couldn't be found", :invalid => "Sorry, but this does not appear to be a valid OpenID", :canceled => "OpenID verification was canceled", :failed => "OpenID verification failed", :setup_needed => "OpenID verification needs setup" } end end It is something possible to translate them without changing the plugin

formatTime with “h” instead of “:” as separator

不问归期 提交于 2019-12-06 06:01:28
We use the following 24 hour format for time in Portugal: 18h30 . I've tried: timeFormat: 'H'h'(mm)' timeFormat: {'H'h'(mm)'} timeFormat: 'H\h(mm)' Is it possible? Thank you. You need to use single quotes inside the javascript string to insert the letter h as literal text. The easiest way for this is to use double quotes as string delimiters, as in: timeFormat: "H'h'(mm)" For reference, if you want to use single quotes inside a single quoted string, use an escape for each quote, as in: timeFormat: 'H\'h\'(mm)' pab An up-to-date solution is reported here and works for FullCalendar2: formatTime

Rails I18n in verification.rb verify method does not work?

雨燕双飞 提交于 2019-12-06 06:00:54
I am using I18n internationnalization plugin, but it's not translating 1 piece of information : In one of my controller, I have a verify method like this : # Verify user is authenticated verify :only => [ :destroy, :create, :update, :new, :comment ], :session => :user_id, :add_flash => { :error => I18n.t(:'Exceptions.not_logged_in') }, :redirect_to => { :controller => 'main' , :action => 'index' } However, using I18n.t(:'Exceptions.not_logged_in') always display the default_locale, in this case, english. I have in my Application_Controller a before_filter that sets the locale. Can anybody help

How to link to language's homepage for untranslated page in django-cms?

空扰寡人 提交于 2019-12-06 05:13:47
问题 Within django-cms I have two languages, with one page in Dutch currently not translated into English. When viewing this page, language_chooser does not provide a link for the English translation (as there is not). However, I would like to link the link to the English translation to link to the homepage (or some other English page if it makes sense). Now I could create the needed template tag myself, or some template trickery, but I think this problem has been solved before. Sadly though, I

Call different (localized) view based on current culture

左心房为你撑大大i 提交于 2019-12-06 05:09:23
问题 I'm using LocalizationAttribute which implements ActionFilterAttribute to localize views. I simply put [Localize] on controller. I was using LocalizeStrings.resx files to apply based on which language is on current thread. Everything works for this simple case (with localized strings). Now I want to localize complete pages (not just strings). To acomplish this which approach do you use? Do I need to identify which thread is current on controller and based on that value to call view: public

Web Application Internationalization, do it server-side or client-side?

女生的网名这么多〃 提交于 2019-12-06 05:01:19
问题 We are looking to internationalize a web application. Is it best to output translation Server-side (it is written in .net 4 C#) or Client-side (Javascript)? We have already begun carrying this out Client-side by creating a JS file which contains a single object containing English phrases as the Keys (so developers understand what each message means in context), with values that are the string which is shown to the client for any alerts and prompts. We are thinking of extending this to all

How to get English month name from date in Russian Excel?

此生再无相见时 提交于 2019-12-06 04:58:17
I am unable to get month name in Excel. Neither =TEXT(...;"mmmm") not doesn't work. I found, only Russian M's are working and giving Russian month name, despite of language settings Latin M's give nothing. Are there any other settings to force month name language? UPDATE Setting date format nationality didn't help: Thanks for additional details. It appears to be a long standing issue with MS Office. See How to prevent Excel to use the OS regional settings for date patterns in formulas for a related issue and some partial solutions. In particular, hardcoding using CHOOSE might be your way to go

messages.properties taken from db [duplicate]

房东的猫 提交于 2019-12-06 04:57:55
This question already has answers here : Closed 6 years ago . Possible Duplicate: Design question regarding Java EE entity with multiple language support I'm working on i18n of JSF application. I need all standard jsf messages that are usually located in messages.properties to be taken from database. Is there some simple way to do it? Thanks. I think I found the answer: public class DBMessagesBundle extends ResourceBundle { @Override protected String handleGetObject(String key){ ... } @Override public Enumeration<String> getKeys() { ... } } and in FacesConfig.xml <application> ... <message