Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Where should I try to hack chat room plugin in order to change the language?

+2 votes
495 views
asked Feb 2, 2015 in Plugins by gunrose
Chat room plugin is a great plugin! Thank you (:-)! However, as I understand there are no translate files. I have been trying to find the places where I could translate by myself some words that are presented to the final user such as "Private Messages", "Inbox", "sent items"?

By the way, I am trying to translate it to Brazilian portuguese where there is already an available translation!

Is there a way to do that?
Q2A version: 1.7.0
commented Feb 2, 2015 by gunrose
As I understood it seems that this plugin is using the original lang file. Can someone point me a plugin that does the same, but allows the functionality of lang-translation? The ones that I know either include extra lang-default files or we can change it in the admin panel!

2 Answers

+3 votes
answered Feb 2, 2015 by pupi1985
selected Feb 3, 2015 by gunrose
 
Best answer

Well, most likely this line says it all: https://github.com/svivian/q2a-chat-room/blob/ce5dbc1c630169ec7ef65e38feb59d338aceac4a/qa-chat.php#L20

Most likely there is a mix between language strings from the core and some custom ones from that plugin itself. E.G., lines 27, 28, 29, 88, 95, 113 and so on. You'll find to spot them one by one. They are spread between files qa-chat.php and qa-chat.js. No other way to translate this.

Regarding your request for a plugin that includes language files, you can take a look at this one: https://github.com/pupi1985/q2a-maximum-tag-length

commented Feb 3, 2015 by Scott
Yes I never got around to adding language files to the chat room plugin. I'll update it when I can.
0 votes
answered Aug 8, 2015 by igael

when you want to translate a dot js file that haven't a function qa_lang() , you must convert all the messages in js variables and set them with the QA function related to content ( $qa-content ) :

writing this in php

            $qa_content['script_var']['js_hello'] = qa_lang('myplugin/js_hello') ;

will produce in header this js line script , assuming the translation is provided in the appropriate lang file :

 

var js_hello = 'Bonjour la compagnie' ;

 

Then, you can safely replace  'Bonjour la compagnie' in the js file by js_hello and be sure that your translation in any language will be well handled.

See qa-ajax.js of the dbsave plugin ( or qa-chat2.js of the chat hack which implements the chat translation )

 

...