PoEdit, warning: internationalized messages should not contain the '\r' escape sequence - wordpress

I am using wordpress with buddyboss as theme. And I want to have other text messages on the registration form. So I follow this tutorial:
https://codex.buddypress.org/getting-started/customizing/customizing-labels-messages-and-urls/
But at the moment I choose for Create new translation. I get this error:
28/01/2022 17:37:15: C:\Users\SAVANT~1\AppData\Local\Temp\poeA4A8.tmp\ref.pot:7544: warning: internationalized messages should not contain the '\r' escape sequence
But when I try to go to that address:
C:\Users\SAVANT~1\AppData\Local\Temp\poeA4A8.tmp\ref.pot:7544:
I even don't see a file with name
poeA4A8.tmp
And yes, I triggered the option show hidden files.
So my question is:
How to fix this?
Thank you

\r "Carriage Return" should not be contained in the string you want to translate.
message += gettext('Message is invalid\r\n')
the correct way is:
message += gettext('Email is invalid') + '\r\n'

Related

Running Go from the command line nested JSON

I can think of workarounds on how to get this working however I'm interested in finding out if there's a solution to this specific problem.
I've got a go program which requires a json string arguement:
go run main.go "{ \"field\" : \"value\" }"
No problems so far. However, am I able to run from the command line if one of the json values is another json string?
go run main.go "{ \"json-string\" : \"{\"nestedfield\" : \"nestedvalue\"}\" }"
It would seem that adding escape characters incorrectly matches up the opening and closing quotes. Am I minuderstanding how this is done or is it (and this is the side I'm coming down on) simply not possible?
To reiterate, this is a question that has piqued my curiosity - I'm aware of alternative approaches - I'm hoping for input related to this specific problem.
Why don't you just put your json config to the file and provide config file name to your application using flag package
Based on the feedback from wiredeye I went down the argument route instead. I've modified the program to run on:
go run main.go field:value field2:value json-string:"{\"nestedfield\":nestedvalue}"
I can then iterate over the os.Args and get the nested json within my program. I'm not using flags directly as I don't know the amount of inputs into the program which would have required me to use duplicate flags (not supported) or parse the flag to a collection (doesn't seem to be supported).
Thanks wiredeye

Sending Email Attachement Through Outlook in R with RDCOMClient

I'm Running a daily analysis that spits out a file I would like sent through my outlook Email. The code I used is featured here, and works wonderfully but the attachment part of it never works...
library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "gkinne#horizonmedia.com"
outMail[["subject"]] = "Bruh"
outMail[["body"]] = "Tester"
outMail[["Attachments"]]$Add("L:/Document.csv")
outMail$Send()
The original is here:
Sending email in R via outlook
The code works until the attachment part, and the email even sends, just with no Attachment. It spits this error out:
<checkErrorInfo> 80020009
No support for InterfaceSupportsErrorInfo
checkErrorInfo -2147352567
Error: Exception occurred.
Any Ideas?
Reverse the slashes and escape them.
The problem is that the path is being created in R, which prefers forward slashes (since the backslash is the escape character), but it's being interpreted by Outlook, which only takes backslashes.
For example, try adding an attachment to an Outlook email by pasting a path into the insert file dialogue, but change the backslashes to forward slashes. It doesn't accept it. And that's essentially what you're trying to do.
So reverse to make them backslashes, then add extra backslashes to each one to escape them. For example:
C:\\Users\\MyFiles\\Documents\\document.txt
R will strip out the escape characters and and pass a clean path to Outlook.
The answer that helped me was provided by David Arenburg in comments:
You need to specify a full path. Is L:/Document.csv a full path? Is L
a local driver or you mapped a network driver? If later is the case
you need to specify the actual network path.
Example: \\dfwcot\Home$\lando\bb8\2015-12-24 Daily Report.xlsx
The Add method of the Attachments class accepts four arguments. I'd suggest specifying them explicitly.
The source of the attachment can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment. Make sure the file is accessible.
You need to do it like this
L:\\Document.csv
Worked for me. Use two backslashes.
I was also facing the same issue of "Error: Exception occurred".
But, in my case i was missing the naming convention of file. So, make sure that the file name must not be separated by SPACE and use delimiter as "-".
You can use the gsub() function to change "/" to double back slashes "\" in your path
Use this:
outMail[["Attachments"]]$Add(gsub("/","\\" ,"L:/Document.csv", fixed = TRUE))
The problem that our customer was facing was that they executed this operation one too many times.
In your example you are using the filename "L:/Document.csv" over and over again.
Outlook will create that attachment in one of the cache folders each time you try to generate this mail. The first one will be "Document.csv", the second one "Document (002).csv" etc...
We saw it running up to (799) and apparently that is the hard limit.
We had to clean out the temp folder in C:\Users<username>\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook<random hex value> to make it work again.
Just double click an attachment in any mail and see where that temporary file shows up and check that directory.

PloneFormGen Override Uppercase Output

I am trying to figure out how to make the replacement parts fields data show up in all uppercase when the email is received. This form will be used for entering serial numbers containing alphanumeric characters which makes it hard to read when lowercase letters are used.
Is there an override that can accomplish this or will the mailer template need to be modified? How would you resolve this?
Assuming the field has the id 'replacement-parts', add a custom script adapter with the key code:
request.form['replacement-parts'] = request.form.get('replacement-parts', '').upper())
Make sure it's above your mailer, as the action adapters are executed in folder-contents order.

Adding IP Address to Email Validation RegEx

I am using the RegEx "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*#[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+[.])*(\.[a-zA-Z]{2,17})$"to validate Email but my lead want to validate as per the Microsoft standard. SO i need to follow
http://msdn.microsoft.com/en-us/library/01escwtf(v=vs.100).aspx
In that everything working fine as per the standard but still i am facing the issues with
Valid: js#internal#proseware.com
Valid: j_9#[129.126.118.1]
the above mentioned mail ID is still returning as invalid. I tried using the regex used in that page
^(?("")(""[^""]+?""#)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])#))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$
but i am getting the error in the server page. Though I pasted the expression inside the validation Expression it can't able to accept the characters.
Note : am using ASP.Net validators for validating the email.
Description
To match both of those email addresses in your sample text, I think I would rewrite your expression like this:
[A-Z0-9._%#+-]+#(?:[A-Z0-9.-]+\.[A-Z]{2,4}|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])
If you're looking to use this to validate a string which may contain only an email then you can add the start/end of string anchors ^ and $.
Example
Live Demo
Sample Text
Valid: js#internal#proseware.com Valid: j_9#[129.126.118.1]
Matches
[0][0] = js#internal#proseware.com
[1][0] = j_9#[129.126.118.1]

Question marks in email for characters like non-breaking space. It only occurs on Unix and not on Windows

I am facing a weird problem related to content type/encoding.
Here is my Java code snippet below. This code works perfectly fine on a Windows machine where the application server is running on windows and the SMTP server for sending emails is also Windows localhost. When I deploy the same code on a Unix server, the email sent for the exact same content contains question marks (???) for special characters like non-breaking white space.
I did a lot of googling, but I did not find any solution. How can I fix this problem? The content types I tried were ISO-8859-1, UTF-8 and Windows-1252. Nothing helps.
MimeMessage message = new MimeMessage(session);
.............
Multipart mp = new MimeMultipart();
MimeBodyPart messageBody = new MimeBodyPart();
messageBody.setContent(mailMessage, "text/html;charset=Windows-1252");
messageBody.setHeader("Content-Type", "text/html;charset=Windows-1252");
// Add body to the multimedia part
mp.addBodyPart(messageBody);
message.setContent(mp);
// Send message
Transport.send(message);
Are you using the same mail server in both cases? And the same client program to view the message?
For debugging, just before the Transport.send call, add:
message.writeTo(new FileOutputStream("msg.txt"));
and then examine the msg.txt file to see if the characters are correctly encoded.
How do you create the text in the mailMessage String? If you don't create the string with the correct Unicode characters, no charset is going to make it right.
Also, you don't ever need to set the Content-Type header explicitly, remove that line.
And, instead of setContent, use:
messageBody.setText(mailMessage, "html", "utf-8");
That makes sure the Content-Type header is set correctly and the parameters (e.g., charset) are quoted correctly.
Ultimately, I had to go with a crude way of doing it. I replaced such characters with space.
mailMessage.replaceAll("[^\\x20-\\x7e]", " ");
Now, all the special characters like non-breaking space or any other character falling out of normal range, will be replaced with space. The email in this case was anyway meant for normal text.

Resources