internationalization

access the CI session in a pre controller codeigniter hook

空扰寡人 提交于 2019-12-24 03:27:55
问题 I am using a pre controller hook to detect and set the site language from the session/cookie/browser lang detection.. something like this answer: Codeigniter language I am also using the famous Tank Auth library to manage users and I am using the codeigniter Session class to store and manage the users sessions upon log in. Each user can specify the interface language he wants and store it in the database for future log ins. The lang info is copied from the DB to the session on every log in.

Parsing user time input in Java/GWT

社会主义新天地 提交于 2019-12-24 03:24:13
问题 What is the best way to parse time that a user typed in a text field in GWT? Default time formats require users to enter time exactly as the time format for locale specifies it. I want to be more flexible as there are many different ways users can enter time. For example, entries like "8", "8p", "8pm", "8.15pm", "13:15", "1315", "13.15" should be valid. 回答1: I ended up with my own method that I want to share. This method returns time in milliseconds, which can be displayed using any data

jQuery ajax call to url containing accent character sends bad Uri from IE to server

北慕城南 提交于 2019-12-24 03:07:31
问题 I was having trouble sending up a url containing accent characters using IE. Here's a simple function: function runjQueryTest(){ var url = "/test/Beyoncé/"; $.get( url, function(){}); } On the server (PHP) I record the value of the request uri ($_SERVER["REQUEST_URI"]) and I see a difference between what FF/Chrome send up versus what IE sends up. Chrome and FireFox cause the value of ($_SERVER["REQUEST_URI"]) to be /test/Beyonc%C3%A9/ but requests from IE 8 show the value of ($_SERVER[

Setup a shortcut to replace easily selected strings in VIM

六眼飞鱼酱① 提交于 2019-12-24 02:57:09
问题 I have a lot of php/html files with many strings that should be internationalized with gettext. Therefore, I have to go through each file, spot the "message" strings and replace each one by <?= _("<my string>") ?> I use vim and would like to setup a shortcut (map) to do it easily in insert mode (With Ctrl R for instance). Do you know how to achieve that ? 回答1: I would use Tim Pope's wonderful surround plugin to accomplish this. Add the following to your ~/.vim/after/ftplugin/php.vim file: let

Text extracted by PDFBox does not contain international (non-English) characters

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:22:24
问题 I'm using Apache PDFBox to extract text from several PDF files. The files are in Polish language and they contain Polish characters. Unfortunately, when I print the extracted text, I keep getting ? (question marks) instead of those characters. 回答1: Assuming your extracted text is stored in String s, I am assuming that you are currently using this to print - System.out.println(s); I suggest you use this snippet for printing out the polish characters properly- java.io.PrintStream p = new java

C# CultureInfo.CurrentCulture says en_US but my Windows settings are set to South Africa

▼魔方 西西 提交于 2019-12-24 00:48:29
问题 I changed my Region/Location in my Windows 8.1 control panel to be South Africa. When I start up my app from Visual Studio 2013 and get the CultureInfo.CurrentUICulture it still says "en-US". public CultureInfo getCurrentCulture() { if (CultureInfo.DefaultThreadCurrentUICulture != null) { return CultureInfo.DefaulThreadCurrentUICulture; } else { return CultureInfo.CurrentUICulture; } } I've also tried CultureInfo.CurrentCulture instead of CurrentUICulture, but they are behaving the same way.

How can I localize argparse generated messages in a portable way?

ε祈祈猫儿з 提交于 2019-12-24 00:24:34
问题 Context: I am developping a small module to automatically rename photographs in a directory according to their exif timestamp (goal: easily mixing pictures from different cameras or smartphones). It works smoothly either as a Python package or directly from the command line through a tiny wrapper using argparse. And I have just had the (rather stupid) idea to localize it in non English language. Ok, gettext is my friend for all my own code, but when I came to agparse generated messages, I

looking for cleaner code when embedding razor calls in text

五迷三道 提交于 2019-12-23 23:59:50
问题 I used to have something like this: We suggest you read our @Html.ActionLink("help page", "Help", "Home") before proceeding. nice and clean. then I decided we needed to internationalise the app. I couldn't figure out a better way to deal with the above than to store the following string in the resource file: We suggest you read our [HelpPage] before proceeding. and then on the view I have to do: @MvcHtmlString.Create(this.Resource("Help").ToString() .Replace("[HelpPage]", @Html.ActionLink(

Angular 2 i18n-internationalisation : message.xlf is empty

◇◆丶佛笑我妖孽 提交于 2019-12-23 23:52:42
问题 I 've been following the angular cookbook for internationalization : https://angular.io/docs/ts/latest/cookbook/i18n.html#!#angular-i18n after a long dependency debugging time, i manage to generate a message.xlf file, without any error but, nothing has been extracted, the xlf is empty. it seems to not see the i18n in my tags... is there anyone who managed to solve this? message.xlf <?xml version="1.0" encoding="UTF-8" ?> <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">

php source code to PO file generator

喜你入骨 提交于 2019-12-23 21:19:39
问题 I have to convert all my echo/print string from my php source code file to PO file (for the language translation ), is there any batch convector available for the same. 回答1: How I do this: make gettext run on your server setup a translation adapter (for example Zend_Translate with gettext adapter) use a good search tool to find all strings in your code and wrap them with something like $translationObject->translate(). Often the method is wrapped to be called __(). This will be at least partly