translation

consolidate successive translations in D3

丶灬走出姿态 提交于 2020-01-15 12:26:07
问题 The following toy code (jsfiddle here) write to the console log translate(20,0) translate(20,0) translate(20,0) translate(20,0) translate(20,0) . Is it possible to get translate(100,0) as a "consolidated" translation? var svg = d3.select('svg'); var rec=svg.append("rect") .attr("width",20) .attr("height", 20) .attr("x", 0) .attr("y", 20) .attr("fill","#00ffff") .attr("transform","") ; for (var i=0;i<10;i++) { rec .attr("transform",rec.attr("transform")+" translate(20,0)") ; } console.log(rec

Develop multilingual system

霸气de小男生 提交于 2020-01-15 08:24:40
问题 This is more of an analytical question. I need to know how best to make a multilingual system, a.k.a. a system where the user can change the language. The language will be stored in a cookie or a database. I've worked in the past with different files for each language, for example: nl.php $lang['hi'] = 'Hoi'; $lang['howareyou'] = 'Hoe gaat het?'; en.php $lang['hi'] = 'Hi']; $lang['howareyou'] = 'How are you?'; index.php include($language . '.php'); As you can see, this system is both

Develop multilingual system

随声附和 提交于 2020-01-15 08:24:11
问题 This is more of an analytical question. I need to know how best to make a multilingual system, a.k.a. a system where the user can change the language. The language will be stored in a cookie or a database. I've worked in the past with different files for each language, for example: nl.php $lang['hi'] = 'Hoi'; $lang['howareyou'] = 'Hoe gaat het?'; en.php $lang['hi'] = 'Hi']; $lang['howareyou'] = 'How are you?'; index.php include($language . '.php'); As you can see, this system is both

convert translated country-names to alpha2 with pycountry and gettext

最后都变了- 提交于 2020-01-15 03:44:16
问题 I'm trying to let my users search for data by country. The users will type in the country name in their native languages. However my database only contains the alpha2 codes for each country. My current approach: user_input = "France" country_code = pycountry.countries.get(name=user_input).alpha2 # u'FR' this works fine if the user input is made in English. Since the data is shown in the users preferred language, she will expect to search for it in her preferred language as well. By using

How to use $this->_() in zend framework views?

淺唱寂寞╮ 提交于 2020-01-13 15:02:27
问题 In my ZF 1.11 application I'm storing my translator in registry like this: Zend_Registry::set('Zend_Translate', $translator); So in my view scripts I can access the translator this way: $this->translate('abc'); Is there any clever way to be able to use this call instead: $this->_('abc'); Using $this->translate clutters the views, and lot's of people are used to seeing _() anyway. 回答1: Whereas I generally agree with the notion that function/method names should be meaningful, I also agree that

Best way to organize your localized translation file

女生的网名这么多〃 提交于 2020-01-13 12:13:31
问题 As I've started building a project, there will be quite a few entries in the .po translation file. I use Poedit to build these. My question is, what is the best practice for entries within this file? I was thinking, instead of referencing entries such as: echo _('This is an entry.'); I was thinking of organizing them like: echo _('error_pwd'); echo _('error_user_taken'); Which, once ran through the translation file, would output something like: Password incorrect. Please try again. Username

PHP Gettext - No translation

▼魔方 西西 提交于 2020-01-13 09:32:26
问题 I am trying to use the PHP gettext extension in order to translate some strings. All functions appear to return the correct values but calling gettext() / _() returns the original string only. The PO/MO files seem correct and I believe I have set the directories up correctly. I am running WAMP Server with PHP 5.3.10 on Windows (also tried running 5.3.4 and 5.3.8 because I have the installations). Firstly, see /new2/www/index.php : $locale = 'esn'; # returns Spanish_Spain.1252 in var dump

PHP Gettext - No translation

爷,独闯天下 提交于 2020-01-13 09:32:14
问题 I am trying to use the PHP gettext extension in order to translate some strings. All functions appear to return the correct values but calling gettext() / _() returns the original string only. The PO/MO files seem correct and I believe I have set the directories up correctly. I am running WAMP Server with PHP 5.3.10 on Windows (also tried running 5.3.4 and 5.3.8 because I have the installations). Firstly, see /new2/www/index.php : $locale = 'esn'; # returns Spanish_Spain.1252 in var dump

Translations and Symfony2 in database

为君一笑 提交于 2020-01-11 17:55:09
问题 File based translations don't work for me because clients need to change the texts. So I am thinking about implementing this interface to fetch data from the database and cache the results in an APC cache. Is this a good solution? 回答1: This could be what you are looking for http://blog.elendev.com/development/php/symfony/use-a-database-as-translation-provider-in-symfony-2/ 回答2: Take a look at the Translatable behavior extension for Doctrine 2. StofDoctrineExtensionsBundle integrates it with

angular-translate does not display character accent or umlaut correctly

时光怂恿深爱的人放手 提交于 2020-01-11 08:04:08
问题 I started using angular-translate. Works great! But a translated character � is displayed for characters with umlaut or accent or ... (like ü or ú or ñ). These same character values are displayed correctly in HTML text and as AngularJS variables. Here's a sample output. The output for html text and angular variable display correctly. The results from $translate filter and directive don't display the correct umlaut character. html text - Und sie untersützt mehrere Sprachen! angular variable -