msgfmt returns the wrong line with an error - gnu

today I'm having a problem.
I deliberately created a .po file in which there is an error.
I expect that the backtrace error appears on the 39 string.
Instead, the validator shows
test.po:1: missing 'msgstr' section - means that validator found error on first line
Attaching a file
msgid ""
msgstr ""
"Language: en_EN\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n"
msgid "About"
msgstr "About"
msgid "Team"
msgstr "Team"
msgid "ICO"
msgstr "ICO"
msgid "Partners"
msgstr "Partners"
msgid "Blog"
msgstr "Blog"
msgid "contacts"
msgstr "contacts"
msgid "Subscribe"
msgid "Subscribe" // << Here must be an error
Please,help

The problem was in carriage return ^M. I converted that carriage return to \n and it works like a charm

I know this is quite old for now, but if there is someone out there like me who got redirected to this question here's the problem:
Investigate the last line a bit further then you'll see that there stands msgid instead of msgstr.
So change from:
msgid "Subscribe"
msgid "Subscribe" // << Here must be an error
To this one:
msgid "Subscribe"
msgstr "Subscribe" // << Here was the error
One thing to mention:
Another problem which could occur is that the " get wrong converted when you are copying your message strings from documents (e.g. Pages, Word, etc.). So keep that in mind.

Related

Unknown symbol in c++ string throws errors

There is a snippet of code I took from an example and it uses a symbol unknown to me, namely », and I can not find anything about it! The snippet is split onto two lines, but if I remove the split in the string, it doesn't throw an error, assumingly because » then becomes part of the "..." string.
cout << "Running 'SELECT 'Hello World!' »
AS _message'..." << endl;
However, another usage of the symbol not involved directly in a string throws an error as well:
cout << "(" << __FUNCTION__ << ") on line " »
<< __LINE__ << endl;
Is this bad syntax for just continuation of a string?

AutoIT getting text with _Stringbeetwen and saving it to .txt file

so I need to get a text from this file in brackets
Lance Hill (born February 17, 1972) is a retired U.S. soccer forward. He spent one season in USISL.
And save it to the Output.txt
Local $fArray
If NOT FileExists("C:\Users\fiwi\Desktop\Input.txt") Then
MsgBox(0, "Error", "Unable to open Exclusion File" & #CRLF & "It appears that the file does not exist.")
Exit
Else
_FileReadToArray("C:\Users\fiwi\Desktop\update.txt", $fArray)
EndIf
local $check = _StringBetween( $fArray, "Comments" , "PDF" )
FileWrite("Output.txt", $check)
Mine script gives me a "0" in a output file.
_StringBetween
_StringBetween has strings as parameters and return an array.
This should work:
$fileContent = FileRead($file)
$array = _StringBetween($fileContent, "Comments" , "PDF")
For $i = 0 To Ubound($array)-1
FileWriteLine("C:\Output.txt", $array[$i])
Next
And you are checking one file, and reading another.
If NOT FileExists("C:\Users\fiwi\Desktop\Input.txt") Then
_FileReadToArray("C:\Users\fiwi\Desktop\update.txt", $fArray)

Display name for sendmai

I have mails coming from RHEL machine with from address XYZ[no-auto-replies#abc.com]and no display name. Please let me know If I can add a display name as XYZ and only mail address asno-auto-replies#abc.com. In simple terms I want display name for mail as XYZ and from mail address as no-auto-replies#abc.com
Please do not tell me any changes in configuration of /etc/hosts stuffs in internet because I do not have privileges cannot change settings.
Below is the code am using. This will help me a lot
$to = 'abc#xyz.com';
$from = "XYZ[no-auto-replies#abc.com]";
$subject = "ABC";
$message = "Check mail";
open(MAIL, "|/usr/sbin/sendmail -t");
# Email Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
# Email Body
print MAIL $message;
close(MAIL);
It's not clear what you mean by "no display name" but your From: header certainly contains a syntax error as it is now. You seem to want something like
From: <xyz#example.com>
or just
From: xyz#example.com
(compare with the To: header which you are already setting this way)
whereas the correct syntax for a header with a display name would be
From: Your Name <xyz#example.com>
where you may need RFC2047 wrapping if the full name contains characters which are not pure 7-bit US-ASCII.

Check user input against words in text file

I am working on an option for my program and it should work like this:
user inputs title
user inputs author
system then checks user's title & author input in the text file named BookDB.txt
if there is already existing record in the text file, system will prompt an error
else it will continue user to input price, quantity available and quantity sold.
book will then be added
I tried playing around with grep but to no avail.
Below are my codes for this particular function.
function fnAddBook()
{
echo "Title: "
read inputTitle
echo "Author: "
read inputAuthor
if grep -Fq "$inputTitle" BookDB.txt; then
if grep -Fq "$inputAuthor" BookDB.txt; then
echo "Error!"
fi
else
echo "Price: "
read inputPrice
echo "$inputTitle:$inputAuthor:$inputPrice" >> BookDB.txt
echo "New Book successfully added!"
fi
}
contents of BookDB.txt
format of the contents | Title:Author:Price:QtyAvail:QtySold
Hello World:Andre:10.50:10:5
Three Little Pig:Andrew Lim:89.10:290:189
All About Ubuntu:Ubuntu Team:76.00:55:133
Catch Me If You Can:Mary Ann:23.60:6:2
Happy Day:Mary Ann:12.99:197:101
UPDATED PROBLEM:
In this case, even if I typed "Catch Me If You Can" as title + "Ubuntu Team" as Author, it raises the error. How can I modify the codes such that it checks line by line?
Thanks in advance to those who helped! :)
There are 3 problems with your code.
The first is that the x option to grep causes it to match only complete lines, and since you put author and title on the same line, this will not match.
With the x option "Gaiman" does not match "Gaiman:Nation:$20", if you remove the x from the grep-options, this will work.
The second problem is that the two greps are independent of eachother. Thus if you have a book titled 'Nation' and a book by 'Gaiman' it will be considered a match, even if the 'Nation' book you have is 'The wealth of Nations' and the Gaiman book you've got is 'Anansi Boys'.
The third problem is that grep will find partial matches. If you try to enter the book "It", then grep will conclude it's already in the database, because "It came from the desert" is.
You need a sentinel-value to delineate the titles to fix this. (the sentinel must be some character that cannot exist in book-titles or author-names)
function fnAddBook()
{
echo "Title: "
read inputTitle
echo "Author: "
read inputAuthor
if grep -Fq "$inputTitle:inputAuthor:" BookDB.txt
then
echo "Error!"
else
echo "Price: "
read inputPrice
echo "$inputTitle:$inputAuthor:$inputPrice" >> BookDB.txt
echo "New Book successfully added!"
fi
}
This assumes that ':' cannot occur in authornames or booknames.

How to left-align IO stream operators << and >> in Vim?

For example, instead of following alignment:
std::cout << "Hello " << "Hello "
<< "world ";
I want left-align the << operator, as:
std::cout << "Hello " << " Hello "
<< "world ";
By default, Vim chooses the first one. Looks like it just increases the indentation by one level for the new line.
So, is there any way that I can get the second alignment by default?
P.S. I already tried the Align plugin, but it aligns the region in a table, like:
std::cout << "Hello World" << "Hello "
<< "World" << "World Hello".
which I consider too sparse.
I'm using Tabular and this works for me
:Tabularize /^[^<<]\S*
Output:
std::cout << "Hello World" << "Hello "
<< "world " << "World Hello";
Explanation
^ Beginning followed by << up to the to first <<, then the match will start exactly at the first <<.
With the Align plugin, the command for aligning selected lines of text the way you want is :<,>Align! l: <<. The first argument is an AlignCtrl Command that tells it to left-align the first field and treat the rest of the line as a single field. The second argument is the separator. The Align manual explains all of the available arguments and pre-defined mappings.

Resources