Fuelphp translate validation messages like "Username already exists" from fuel\packages\auth\classes\auth\login\ormauth.php - package

I am new to Fuelphp and I am trying to translate the validation error messages like "Username already exists" from packages, the file is fuel\packages\auth\classes\auth\login\ormauth.php. I searched for the documentation, looked on fuel forums but I can't figure it out. I want to translate the mesage without modydfying the file from the package.
I tried to override the main file, fuel\packages\auth\classes\auth\login\ormauth.php by copying it in fuel\app\packages\auth\classes\auth\login\ormauth.php but seems to not working.

Related

How to transalte messages that comes from server in react native app

I'm building a react-native app with spanish as default language, the problem is that I'm using a open source backend service to serve data and this data comes is in english by default. What I want is to transalate this data/messages that comes from server in my react-native app to show to the user the messages in spanish not in english.
This is the first time I am doing this process and it is not clear to me what are the steps or the flow that is generally followed for this kind of proces(translate messages that comes from server in my app).
You have many approaches to such a thing one comes to mind is
Catch the error/api response message which mostly server error messages comes in codes and messages.
set a condition statement if code equal 2 that means the server is down for example
Example:
You made a request to the server and there was an error with the server let say wrong username and password, now the server returns a message and a error code you have to get the code or the message and show your own message
.....made the request the server returned
{ code: 192, message: Wrong username/Password }
now in your code you will do the following
if(code == 192){
...do your message
}
P.S this is just on top my head since you didn't share any codes or responses from your server.
UPDATE :
If you want to translate all your strings/messages that comes from the server you would need to do another approche something like this
Create a file contain all the strings/codes from the server
compare messages/code comes from the server and the file will return the text you want
{ "102": "Hola", "103": "Bien", "104": "Nada", "105": "Si", }
now this file contain the error/message code all you have to do is when you receive the code grab the message from this file
let translation = {
"101": "Hola",
"102":"Si"
};
translation["102"]; // Result will be Si
Now this is the most accurate approach but you have to know all the messages/codes comes from the server, now if you want something to translate on the fly you might wanna use translation library and may not be accurate translation

Error handling messages for restfull API serving SPA?

We are facing problems working with django rest framework when it comes to error handling. auto-generated errors are json objects that looks like
{"age": "this field must be an integer"}
Clients need something more user friendly like :
age field must be an integer.
Any solution to handle this ?
you can make your own error_codes.py file and put your own readable error with your own error code for example like this....
HTTP_MY_ERROR = {"error_desc": "your own readable error",
"error_code": 99}
now you can send your function response as...
return Response(error_codes.HTTP_MY_ERROR, status=status.HTTP_400_BAD_REQUEST)

What is the maximum length of a parameter in loadrunner?

I am a beginner in loadrunner. I am working with Loadrunner 12.53. I have recorded one simple which will login to one application and Logout.(I recorded with user1 login id) I am testing it with different users say(user2, user3, user4,..., user10, user11). The script is passing successfully till user9 and it is failing from user10. I am getting below error: HTTP-Internal application error
The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ClearCurrentUserFormApplication'. The input source is not correctly formatted.
All the users are existed in that application. Is it because of the change in length of the parameter?
Record your site with User 10 settings. Compare to a recording for User9. The differences in structure will need to be addressed

java mail attachments getting corrupted

This is my code for attaching the files to the mail:
Multipart mp=new MimeMultipart("mixed");
BodyPart mbody=new MimeBodyPart();
mbody.setHeader("Content-Type", "text/html; charset=us-ascii");
mbody.setHeader("Content-Transfer-Encoding","7bit");
mbody.setContent(content2, "text/html");
mp.addBodyPart(mbody);
for(File file:f){
BodyPart mbody2=new MimeBodyPart();
DataSource ds=new FileDataSource(file.getAbsolutePath());
mbody2.setDataHandler(new DataHandler(ds));
mbody2.setFileName(ds.getName());
mbody2.setHeader("Content-Type", "multipart/mixed");
mbody2.setHeader("Content-Transfer-Encoding", "base64");
mp.addBodyPart(mbody2);
}
m.setContent(mp);
content2 is the html content I am embedding in the E-mail, and I am adding files from an arraylist f.
The problem here is that although the files get attached and I receive the E-mail fine, I am unable to open the attachments because the data is corrupt. This happens for all the files I've tried to attach like jpegs, pdfs, spreadsheets, word docs and txt files.
I read here: https://community.oracle.com/thread/1589120 that this could happen because JavaMail uses encoding that messes up the binary data of the file and adding mbody2.setHeader("Content-Transfer-Encoding", "base64"); should fix the problem but that doesn't work for me.
Any ideas on what could be wrong?
Thanks
Time for some debugging...
First, remove all of the setHeader calls; some of them are wrong and none of them should be necessary.
Next, determine if the problem is on the sending end or the receiving end. Try multiple mail readers to see if they all have problems with the attachments.
Try sending plain text attachments. Are they also corrupted?
Post the protocol trace showing what happens when you send a simple message with a simple attachment that fails, so we can see if the message is being constructed correctly.
What version of JavaMail are you using?
What mail reader are you using to view the attachments?

Opening/decrypting Webex Connect db3 file

So I have a lot of instant message logs/history that I want to back up from my chat client, Cisco WebEx Connect in Windows 7. These are stored under C:\Users\\AppData\Local\WebEx Connect\Archive and the file is called "myemailaddress".db3
After downloading SQLiteBrowser to open this file, I get the error:
SQLiteManager: Error in opening file "myfile".db3 - either the file is encrypted or corrupt
Exception Name: NS_ERROR_FILE_CORRUPTED
Exception Message: Component returned failure code: 0x8052000b (NS_ERROR_FILE_CORRUPTED) [mozIStorageService.openUnsharedDatabase]
The file isn't corrupted so I'm thinking perhaps it is encrypted in some way - opening the file in Notepad displays random characters like the following, with no recognisable text:
=¢^£ÍV¶»ñû‡«–
`×ÚµÏýº°ÎîÎL
Besides that file which contains the actual messages, there is another small 20kb file under the folder ConnectDB that has various config settings (such as create CacheTable) and it says on the first line (when opened in Notepad): "SQLite format 3" - so clearly this one isn't encrypted.
Is there any way to extract the data from the first file to something readable (ie, text)? It's only around 5MB in size so shouldn't be causing any memory issues.
Unfortunately I haven't found a way for decrypting this file, however if you're still able to access the messenger client and have a live account you can still export them person by person by clicking on the person in question (make sure you've got view offline people enabled if you're retriving offline user's chat history) > click on the history tab > click on "save as".
I hope this is of use to you.

Resources