Questions tagged [gettext]

Gettext is an internationalization and localization (i18n) library which is commonly used for writing multilingual programs. Its most popular implementation is that of the GNU project.

Gettext is an internationalization and localization (i18n) library which is commonly used for writing multilingual programs. Its most popular implementation is that of the GNU project.

I18n with gettext works by marking up translatable strings in the source code, usually by wrapping them with a function call. The xgettext tool extracts these strings and creates a text file listing them. This file is called the template and its name usually ends in ".pot".

The msginit tool creates a new text file mapping the extracted strings to their translation in a given locale, having the ".po" extension. Finally the msgfmt tool creates an optimized representation of the translation mappings that is then used at runtime. For most programs this is a binary file ending in ".mo", but it is also possible to create other formats, for example a java ResourceBundle.

There are specialized editors for editing the ".mo" files, which can remember already translated strings and contain databases of repeatedly used words.

1756 questions
0
votes
2 answers

BeautifulSoup getText throwing an error

I'm trying to read the text from a web URL using the following code to store all valid strings to a variable which I can manipulate later. I am getting an error at run time though from bs4 import BeautifulSoup import urllib.request from…
algorhythm
  • 3,304
  • 6
  • 36
  • 56
0
votes
1 answer

Wordpress: using gettext in custom wp_nav_menu

I am coding a Wordpress Theme and want to make it translation ready using gettext. Everything works fine except for the $args array of the custom menu. 'primary', 'menu' =>…
george
  • 167
  • 1
  • 4
  • 16
0
votes
1 answer

Android get text from current context

I'm trying to implement a service that gets generally any text from current view or current foreground context , i'm sure android talk back in android kitkat implements this before passing the text to tts. Any idea what Apis should be used for…
user2469133
  • 1,940
  • 3
  • 21
  • 33
0
votes
1 answer

Trouble with setlocale

Does anyone happen to know why a call to setlocale would fail for a reason other than the locale package not existing. The following code: $language = 'fr_CA.utf8'; //putenv("LANG=" . $language); var_dump(setlocale(LC_ALL, $language)); // Set…
Joseph Pla
  • 1,600
  • 1
  • 10
  • 21
0
votes
0 answers

Gettext localization with ANSI color escapes in C programs

I have an C application that makes use of ansi color codes which are defined like this: #define RED "\x1b[31;01m" #define RESET "\x1b[0m" These defines are used in prints to color the output: /* Actual example: */ log_error(_(RED"FATAL:…
Sahib
  • 223
  • 1
  • 10
0
votes
2 answers

EditText doesnt return value from field

Hello i have problem with getting value from EditText field My code is: public class GameSetupActivity extends Activity { DatePicker datepicker; TimePicker timepicker; DatabaseManager dbm = new DatabaseManager(this); public EditText…
0
votes
2 answers

How to use getText while dropping certain characters

Needing some simple help here. Basically, I've got this line: String stringA = numA.getText().toString(); However, the numA editText that this is using also has a DecimalFormat method called on it before it gets to this point, which makes the out…
REAL O G
  • 693
  • 7
  • 23
0
votes
1 answer

Gettext with PHP and Linux: can't switch languages

I am trying to build a multilingual site with PHP (Linux Mint in German, XAMPP) and I am not able to switch between languages. To rule out all other potential problems, I broke the whole code down to the minimal…
tom123
  • 1
0
votes
2 answers

PHP OOP: Can the value of an object property be a function?

My question is quite simple: In PHP OOP I want the value of an object property to be returned by a function. To be specific: I want a string to be translated with gettext. But it seems, that the value of a property has to be a string, a number or an…
Christian
  • 325
  • 2
  • 10
0
votes
1 answer

Sublime Text regex: replace Strings with Gettext

I made a mistake writing a template page in Wordpress and so I put regular strings everywhere instead of Gettext calls. Now I should replace all strings in these specific constructs with Gettext…
0
votes
1 answer

gettext - Load local catalogs

While developing and translating an application, it might be nice if gettext will use the catalogs found in the local po/ dir so it wouldn't be necessary to call make install each time. Is there a way to do it? One of the problems is the naming…
Guy
  • 1,984
  • 1
  • 16
  • 19
0
votes
1 answer

php gettext not working on Windows Server 2008, PHP 5.5

I have a problem getting gettext to work on Windows Server 2008 R2, PHP 5.5 I do the following in my php script: $language = 'NB'; putenv("LANG=".$language); putenv("LC_ALL=".$language); setlocale(LC_ALL, $language); $domain =…
user1660218
  • 83
  • 2
  • 2
  • 7
0
votes
1 answer

Gettext not working

I'm trying to get gettext to work in a localserver, but it's just not working. It's not giving me any kind of error, it just returns my string in spanish instead of translating it to english. This is index.php
jabsatz
  • 341
  • 3
  • 10
0
votes
1 answer

Dynamic content using .PO file

I have a Wordpress site that has support for other languages using the gettext system. I am curious if I can call content dynamically, let's say from function the_content(): printf( __( '%s', 'my-theme' ), the_content() ); I'm guessing this is only…
Rob Myrick
  • 859
  • 11
  • 28
0
votes
1 answer

Create UITextField on UIView but can not get text input

I am using Xcode 6 and doing a small project on iOS 8, and I need to render some text onto the View. My method is to create a UITextField on a UIView and as long as people type onit, the app redraw the View: - (void)viewDidLoad { [super…
Tony Chol
  • 3
  • 1
  • 4