w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Django i18n blocktrans vs trans
From Django Docs Trans template tag The {% trans %} template tag translates either a constant string (enclosed in single or >double quotes) or variable content: With a Trans tag, you are limited to a single constant string or variable. So you would have to use {# These Would Work! #} title>{% trans "This is the title." %}</title> <title>{% trans myvar %}</title> But could not use {%trans "This is my title {{ myvar }}" %} Blocktrans template tag Contrarily to the trans tag, the blocktrans tag allows you to mark complex sentences consisting of literals and variable content for translation by making use of placeholders: With a Blocktrans, this kind of code is possible: {% blocktrans with book_t=book|title author_t=author|title %} This is

Categories : Django

Gettext/Django for german translations: formal/informal salutations
You can use contextual markers to give your translations additional context. logout = pgettext('casual', 'Do you want to log out?') ... logout = pgettext('formal', 'Do you want to log out?')

Categories : Django

Using jquery i18n plugin for i18n?
I don't try it but I think you should put the *.properties files in public/resources directory. And the path shoud be: jQuery.i18n.properties({ name:'Messages', path:'../resources/', // changed here mode:'both', callback: function() { alert("message "+jQuery.i18n.prop('myForm.success.msg')); } Try it.

Categories : Javascript

I want to find the word and replace the 3 word after the search string with my desired word in batch script
You were close. See mods to your code below. If you really want the first word after wordB... this will do it. Don't enable delayed expansion if you don't need it because that just messes you up if there are ! in the text. @echo off SET InFile=test.txt FOR /F "tokens=*" %%A IN ('FINDSTR "wordA" "%InFile%" ^| FINDSTR "wordB"') DO CALL :FindString "%%A" pause goto :eof :FindString SET String=%~1 SET String=%String:*wordA =% SET String=%String:wordB =% FOR /F "tokens=1" %%A IN ('echo.%String%') DO ECHO.%%A :goto :eof

Categories : Batch File

Is there any way to change word to another word depends on the condition inside the word?
Not sure exactly what you are after, but here is something: var startvalue = 0; if(MINVALUE > 0) { startvalue = MINVALUE; } Else if(MINVALUE < 0) { startvalue = MAXVALUE; } var result = String.Format(@"CREATE SEQUENCE ""MY_TEST_SEQUENCE"" MINVALUE 8 MAXVALUE 999 INCREMENT BY 1 START WITH {0} CACHE 20 NOORDER NOCYCLE",startvalue) Some more clarification of your question would allow for more useful answers.

Categories : C#

How to loop a MS Word macro applying word by word in a selection?
You can do something like this: Dim myRangeIndex As Range Dim myRangeStart As Range Set myRangeStart = Selection.Range For Each myRangeIndex In myRangeStart.Words() myRangeIndex.Select Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.TypeText Text:="a" Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Font.Color = -603914241 Selection.Font.Size = 1 Selection.MoveRight Unit:=wdWord, Count:=1 Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.MoveRight Unit:=wdWord, Count:=1 Selection.MoveLeft Unit:=wdCharacter, Count:=1 Selection.TypeText Text:="a" Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend Selection.Font.Color = -603914241 Selection.Font.Size = 1 Selection.MoveRight Unit:=wdCharacter, Count

Categories : Vba

I have a getText error
It's String str = jtf.getText(); not String str = getText(jtf); To fix the String str error you need to make the variable a class instance variable. Better yet just make the JTextField jtf a class instance variable and retrieve the text from that. public class FrameTest implements ActionListener { private JTextField jtf; FrameTest() { JFrame jf = new JFrame("Welcome"); jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE); JPanel jp = new JPanel(); jf.add(jp); JLabel jl = new JLabel("Please enter your name"); jp.add(jl); jtf = new JTextField(30); jp.add(jtf); JButton jb = new JButton("Submit"); jp.add(jb); jb.addActionListener(this); jl.setForeground(Color.black); jf.setVisibl

Categories : Java

php gettext blank only
If you have english texts in source files, you do not need en version of catalogs. Try to look to logs, text should show up, there will be something wrong. Also try to restart server, catalog are cached. This is how I am using gettext, tested on windows/linux server: function setLocaleByLang($lang) { bindtextdomain('app', APPDIR . "/locale"); // APPDIR is definded constant including root of application bind_textdomain_codeset('app', "UTF-8"); textdomain('app'); $map = array( 'cs' => array('cs_CZ.UTF-8', 'cs_CZ', 'cs', 'czech'), 'en' => array('en_US.UTF-8', 'en_US', 'en', 'english'), 'de' => array('de_DE.UTF-8', 'de_DE', 'de', 'german'), 'pl' => array('pl_PL.UTF-8', 'pl_PL', 'pl', 'polish'), 'sk' => array('sk_SK.UTF-8

Categories : PHP

Unable to getText the value of string
First of all String i, j, k; i = Integer.parseInt(t1.getText()); j = Integer.parseInt(t2.getText()); k = Integer.parseInt(t3.getText()); This is wrong. You are assigning String for int. Correct them first. and if you want int values it is better to use int i, j, k; and use trim() to avoid additional spaces. i = Integer.parseInt(t1.getText().trim()); j = Integer.parseInt(t2.getText().trim()); k = Integer.parseInt(t3.getText().trim()); In your case use as follows i = t1.getText(); j = t2.getText(); k = t3.getText();

Categories : Java

NullPointerException when trying to getText from another panel
The cause of your NPE is obvious: private ChatBox box; this is equivalent to: private ChatBox box = null; Then here you use box: messagePane.append(box.getSendText()); // Here is where I am getting the NPE. But you never give the box variable any viable object reference, and so when you try to use it it will of course be null. But more importantly, how are you trying to connect these two classes because I see no code that does anything of this sort. The solution is to first think how you want objects to be connected, to communicate with each other, and then write the code so that this will happen. Perhaps you want to create a new ChatBox object in your MessageWindow class: private ChatBox box = new ChatBox(); but if one already exists and is already part of a GUI, then you

Categories : Java

Selenium 2 gettext() without getting those from subnode
You need to do this with JavaScript. If your webDriver (like Firefox, Chrome, ...) supports that, you can do it like this: public class Main { //@formatter:off final static String JS_SCRIPT_GET_TEXT = "var element = arguments[0]; " + "var text = ''; " + "for (var i = 0; i < element.childNodes.length; i++) " + " if (element.childNodes[i].nodeType === Node.TEXT_NODE) " + " { " + "

Categories : Java

Check if gettext language is available
Why does the locale code de_DE work, when the directory structure is locales/de/LC_MESSAGES/file.po I think it is a fallback. I am initializing my gettext by this: $localeCode = 'en_US.utf8'; //<---- putenv('LANG=' . $localeCode); putenv('LANGUAGE=' . $localeCode); But I only have en_US directory and it works perfectly. How can I check that a locale is installed? e.g. If I want to use de_DE.utf8, but that's not available so I must fallback to de_DE, or zh_HK is unavailable so I want to fallback to zh_CN. I know these are edge cases, but I'd like to make the code as robust as possible. To clarify, this is if the locale is available on the system (as shown using the locale -a command), not if the file is available in the system. I think they a

Categories : PHP

Gettext() with larger texts
function gettext http://www.php.net/manual/en/function.gettext.php it's defined as a string input so your machines memory would be the limiting factor. try to benchmark it with microtime or better with xdebug if you have it on your development machine.

Categories : PHP

gettext() intelesence is not available in selenium
To get anything from a pop up window you have to switch the driver over to the new window: driver.switchTo().window("WindowName"); You can get the window handles (selenium specific) by calling: driver.getWindowHandles(); this returns a set of string handles which you can then pass to the switchTo().window() method. Once you are in the desired window you can get the element's text.

Categories : Selenium

gettext() - on 3 languages 2 works one not
Your test code is not particularly helpful. We'll simplify it this way: var_dump( setlocale(LC_ALL, 'pl_PL.UTF-8') ); You vaguely suggest in your comments that you're getting FALSE. What does it mean? According to the documentation (I suppose you've already checked it, I'm just posting it here for completeness): Returns the new current locale, or FALSE if the locale functionality is not implemented on your platform, the specified locale does not exist or the category name is invalid. So, how do you get a list of available locales? As you've been said: echo `locale -a`;

Categories : PHP

jTextField.getText() in a different class
Explain this in more detail please, then someone/i might be able to help you. Edit: It is hard to see what EXACTLY you are trying to do but, if you need to save of open a file, check out JFileChooser (http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html) Edit2: Putting text from the texfield into a string: String yourtext = JTextField1.getText();

Categories : Java

How can I use GNU gettext in xaml and resx
In a similar case (it was Silverlight), I successfully used Vernacular: https://github.com/rdio/vernacular It's not GNU gettext per se, but use the same file formats and ways of working. That means your translators can use their tools inputing and outputting .po files. To give you some examples, here's how it look in C#: Console.WriteLine (Catalog.GetString ("Hello, World"); There are plenty of overrides: for plurals, gender, and additional translators comments: https://github.com/rdio/vernacular/blob/master/Vernacular.Catalog/Vernacular/Catalog.cs In xaml, it looks like this: <TextBlock i18n:Catalog.Message="Hello, World!" /> Catalog.Message is an attached DependencyProperty in this case, so it applies to a lot of controls (all ContentControl plus some more) The tool use

Categories : C#

Convert gettext po file to php array
PowerGrep You could use Powergrep. You can search trough files by regex. Then export the matches to an file snf import them to your translation software. Agent Ransack An free alternative is software called Agent Ransack. It support exporting and searching with rexeg.

Categories : PHP

Identifying a standard gettext pot file
I suppose it's 'fuzzy' because the headers are not complete. i.e. the template entries will be filled in when the PO files are generated from the POT. The official Gettext xgettext tool that generates POT files from source code also adds the fuzzy flag to the header. By that token it is certainly not against the standard.

Categories : Misc

EditText.getText().toString() sometimes returns ""
If you were going through the debug mode, have in mind that it has two places where it stores values. In my case EditText had mText (Spannable String Builder) and it's sub field (also mText) is the one with ID. The spannable string builder will return value of .toString(). The other one will return value of .getText().

Categories : Android

EditText getText() returns different value then what is displayed
I solved it by calling finsViews() and initPrefs() in my onResume() Method. Although I am not sure why this solved the issues seeing that these two methods were being called from the oncreate whenever I cam to the Fragment. If someone could explain this further It'd be greatly appreciated

Categories : Android

PoEdit does not see gettext in html tags
You need to edit the Poedit parser settings to parse HTML files. To do so, click on File->Preferences, choose the 'Parsers' tab, choose the PHP parser and click 'Edit'. The second field of the 'Parser setup' dialog box shows the extensions used by the parser. You can change the *.php value for the following: *.php;*.htm;*.html

Categories : PHP

Gettext and poEdit doesn't work
First possibility: You have to check the catalog properties (Open the .po file in POedit program then choose Menu 'Catalog'->'Properties' or simply just Alt+Enter, and check the Sources Path Check the base path is correct refer to C:UsersHSSkyDriveWebkodningwampwww est Make sure youu already add "." (without quotes) in paths Second possibility: When you test the code use the lower string parameter for locale (de_de not de_DE) like this htttp:url est.php?locale=de_de Third possibility: Make sure poedit already generate the .mo file and if it's already then try to restart your WAMP server Hopefully it will help

Categories : PHP

php gettext directory structure on different environments
If you're running your code on Linux, gettext works only with locales already installed on the OS. This means that if you set the locale to en_GB then if the only installed locale is en_GB.utf8 or en_US, then you don't get the translations. Try this on both of your environments and compare the results: locale -a It gives you a list of all the installed locales: en_US en_US.ISO8859-1 en_US.ISO8859-15 en_US.US-ASCII en_GB en_GB.utf8 de_DE de_DE.utf8 C POSIX Now you need to make sure that both of the environments have the same locales installed; If you need en_US.utf8, en_AU, and en_AU.utf8, you can create the missing locales based on an existing one (read localedef manpages to know the details): sudo localedef -c -i en_US -f UTF-8 en_US.utf8 sudo localedef -c -i en_GB -f UTF-8 en_AU

Categories : PHP

EditText Throws NullPointerException On .getText()
The first time you create the id numOfItems is 2, not 1 which leads to a first id if 1002. Then in your loop, you try go get the id 1001. Output all the created ids in log statements, that will help you see the problem.

Categories : Java

python gettext different languages at same time
I have next render_template function for emails: def render_template(template_name_or_list, **context): # get request context ctx = _request_ctx_stack.top # check request context # if function called without request context # then call with `test_tequest_context` # this because I send email from celery tasks if ctx is None: with current_app.test_request_context(): return render_template(template_name_or_list, **context) # I have specific locale detection (from url) # and also use `lang` variable in template for `url_for` links # so you can just pass language parameter without context parameter # and always set `babel_locate` with passed language locale = getattr(ctx, 'babel_locale', None) if locale is None:

Categories : Python

Preg_match find word after a word and after another word
if (preg_match_all('/classs?=s?"gametitles+(w+)"><[^>]+>s?(w+)/', $text, $matches)){ $word1 = $matches[1][0]; $word2 = $matches[2][0]; } Or with preg_match: if (preg_match('/classs?=s?"gametitles+(w+)"><[^>]+>s?(w+)/', $text, $matches)){ $word1 = $matches[1]; $word2 = $matches[2]; }

Categories : PHP

Using gettext and database driven translations simultaneously
You can generate pot/po files directly from the database and feed them into Pootle then. Then you would be able to use gettext functions directly on values returned from database. As an example, you can look at phpMyAdmin, where we use similar approach to translate structured text file.

Categories : PHP

Android can't get EditText getText().toString() in a Dialog
You are inflating a new layout, where the EditText has no text in it. You'll need to only once inflate your layout, and keep a reference to it. final View view = inflater.inflate(R.layout.loginlayout, null); /* ... */ .setView(view) /* ... */ EditText text = (EditText) view.findViewById(R.id.loginEdit);

Categories : Java

The method getText() is undefined for the type ListView
You cannot put text directly in a ListView - the purpose of a ListView is to contain other Views. Put a text-compatible view such as a TextView within your ListView, and call setText() on that. If you really wanted a ListView that could directly display text, you'd have to make your own subclass which extends ListView and does some odd overlay or substitution magic to let you display text directly on it.

Categories : Java

Working with JPasswordField and its getText/getPassword method
Using SHA-256 digest is a hash method, not a cryptologic one. It is like a fingerprint. Can you get a person from his fingerprints without testing everybody's (6 billions) fingerprint ? No. It used to store password in databases in php, for example. We just store the pass's hash, and when the user want to connect, we compute the newly entered password hash, and compare it with the database's hash. This prevents users from stealing passwords if the database is hacked. But you cannot get the password from the hash. I hope i answered to your question. By the way, consider using apache lib for message digest, it is easier and more safe i think

Categories : Java

Default php gettext variable interpolation settings
I'm not 100% sure what you're trying to do, but is it something like this? $s = "Some Text"; echo "$s contains: {$s}"; Result: $s contains: Some Text Please post some code to clearify the problem.

Categories : PHP

performance overhead of the gettext internationalization system in C/C++
Given that the alternative to this approach is to have a large number of builds, each with something like this in it: int main() { printf( #ifdef SWEDISH "Hej världen " #elsif ENGLISH "Hello, World " #elsif PORTUGUESE "Olá, Mundo " #else #error Language not specified. #endif ); return 0l; } instead we get: int main() { printf(gettext("Hello, World ")); } which is easy to read and understand. I don't know the exact structure of the gettext implementation, but I would expect that it is a hash-table once it's loaded. Possibly a binary tree, but hash-table seems more sensible. As to the exact overheads, it's very hard to put a number on it - especially, as you say, if something is swapped to disk, and the disk has stopped, it ta

Categories : C++

My Clipboard.GetText() not working please help... (Windows Phone)
Clipboard.GetText is not available to Windows Phone applications. MSDN states: You cannot get clipboard text from a Windows Phone application, only set it. Calling the GetText method in a Windows Phone application will always cause a SecurityException to occur. Reference I am not aware of any way to read the clipboard data in Windows Phone.

Categories : Misc

Django - Integrating django-profiles (and django-registration) with django-facebook
Here's how I suggest you do things. Do away with django-facebook and look into django-allauth. It will handle accounts (registration, logic, connecting social accounts). Also, django-profiles has many issues with 1.5+ for me and I don't bother with it and instead create my own profiles app and UserProfile model with any additional fields that wouldn't be handled by django-allauth. An example from one of my implementations class UserProfile(models.Model): user = models.OneToOneField(User) default_address = models.OneToOneField(Address, blank=True, null=True) default_tshirt_size = models.CharField(blank=True, null=True, choices=constants.tshirt_sizes, max_length=50) default_shoe_size = models.CharField(blank=True, null=True, choices=constants.shoe_sizes, max_length=50) Y

Categories : Python

Clipboard.GetText() always returns empty string in Mono on Mac
It may be that mono is interpreting TextDataFormat.UnicodeText to mean utf-16 but the 'other application' is placing the text on the clipboard as utf-8. The following is a patch that, if I remember correctly, fixed an issue similar to this. clipboard patch You will need to build mono from and apply the patch to try this out.

Categories : C#

EditText.getText().toString() crashes on button click
Where is it crashing? I think that is crashing here: Toast.makeText(null, "Got My String.", Toast.LENGTH_LONG).show(); You cannot pass a null context to makeText. If you are in an activity pass it this otherwise (if you are in a fragment) pass a getActivity() Also, in Java, NEVER use != or == with strings but ALWAYS s1.equals(s2) (and before it do a null check)

Categories : Java

EditText created dynamically : getText() doesn't return a value
getText returns the result of a previous setText. Call firstname.setText("your string") . In the snippet you provide the user has not time to enter text. When you call the commit is to late. You can, for instance, have a "confirm button" and when you click upon it, in its onClick call commit on your edittext, or you can implements TextWatcher private class MyTextWather implements TextWatcher { @Override public void afterTextChanged(Editable s) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // it is called every time you put something inside your edittext }

Categories : Android

The method getText() is undefined for the type String error
It seems that you have shadowed an attribute email by calling a variable with the same name. Hence email does not reference what you meant anymore (a textfield I suppose) but a String. You should change the name of your variable.

Categories : Android

PHP gettext translate in wrong language when running from shell
I've found a fix.... I need to put: putenv("LANGUAGE="); just before I set the locale. I found the answer here: Gettext not working through php-cli, but works in php-apache Do not think I did not search before, I did, but that question is using other words! I hope it helps someone!!!

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.