FAQ Database Discussion Community


Purpose of ugettext inside of Models

python,django,gettext
In plenty of Django tuts, and everywhere online, people will create fields such as the below within a model class: from django.db import models from django.utils.translation import ugettext as _ class MyModel(models.Model) created = models.DateTimeField( _('Created'), auto_now_add=True ) I understand what ugettext is doing but I don't understand why it's...

Display users input from editText field on a textView

android,android-edittext,textview,gettext
I use getText(); on an editText using the code below and want the users input to replace a textView then how do I do this? btw the code was taken from this question: Get Value of a Edit Text field Button mButton; EditText mEdit; /** Called when the activity is...

Wordpress string translation function output blank

php,wordpress,translation,gettext
I have done the following: Wrapped all my non content managed string translations in __() or _e() functions. Added the following to my function.php file: //Add localisation load_theme_textdomain('whitelabel', get_template_directory() . '/languages'); //Set locale $locale = get_locale(); $locale_file = get_template_directory() ."/languages/$locale.php"; if ( is_readable( $locale_file ) ) require_once( $locale_file ); Used...

PHP gettext (WordPress Plugin) change the font style

php,html,wordpress,gettext
Good Day Everyone, I am currently developing a WordPress plugin that will be "translatable". My problem that I have is if I use special font style in my string that is returned I also see the "html" police modification. For example: __('This <strong>text</strong> has to be bold', 'my-plugin') How do...

Django showing msgid instead of msgstring

python,django,gettext
I have correctly set LOCALE_PATHS in my settings. LANGUAGE_CODE is set to it. As a test, the only language I translated the app into is it. In one of my views I have {% trans "MY_MESSAGE_ID" %} and in django.po I have msgid "MY_MESSAGE_ID" msgstr "It is working" If a...

Tornado: HTML inside gettext function string

html5,tornado,gettext
I am using gettext for internationalisation. I have HTML tags in one sentence, but after translation the HTML tags are shown as string. msgid "<strong>Dokument(e)</strong> offline verfuegbar machen<br>" msgstr "<strong> Dokument(e)</strong> offline verfügbar machen<br>" Does someone has more experience with this? I need this output: Dokument(e) offline verfügbar machen but...

Word conjugation with Django i18n and gettext

django,internationalization,gettext
Currently, I have the following code in a template file in my Django project: {% blocktrans with type=content.get_type %}Edit this {{ type }}{% endblocktrans %} The {{ type }} is a string that can have values such as "lecture" and "exercise". Here is the output in the .po file: msgid...

setText issue using getActionCommand

java,gettext,settext
I am a beginner programmer trying to make a simple calculator. Towards the end of my code I try and have the text field show whatever button the user presses. For some reason the text.setText("7") does not show up in the text field. Could you please help me with this?...

gettext module in angularjs does does not translate gettextCatalog.getString() in controller

angularjs,translation,gettext
Im using gettext module for angular to handle my translations. This works almost perfectn. gettext Now i have 2 controllers. 1 is called basecontroller other controllers are per view. so the base controller is attached to the html tag and using ngRoutes i attach a diffrent controller to each view....

Gettext example not working on Windows 7 - XAMPP

php,localization,gettext
I have the latest XAMPP (3.2.1) with PHP 5.6.8 and gettext enabled. I'm trying to get gettext() working there using a sample I've found on the internet: https://github.com/leftnode/gettext-example , but it is not working. Other code I've tried (translation.php): <?php session_start(); $textdomain = "messages"; $lang = "de_DE"; echo(putenv("LC_ALL=".$lang)."<br>"); // outputs...

php gettext included from different folders doesnt work?

php,localization,gettext,poedit
i am trying to localize my code and i want to use gettext and poedit to do so it seems like the most straight forward way to do it. I initialize all my classes and views from a simple script which includes this. I am struggling to understand how the...

CakePHP how to change __() language in the same request

php,cakephp,localization,internationalization,gettext
I'm on CakePHP 2.6.x My app is localized in French and English. English is the default. My translation files currently look like this: /app/Locale/eng/LC_MESSAGES/default.po /app/Locale/fra/LC_MESSAGES/default.po In my views, I normally can show localized text for the current language like this: echo __("Foo"); However, in a few situations I need to...