Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+26 votes
in Plugins by


i know how to translate by .mo and .po But i don't understand how Q2A translate method. I did try to follow this answer:


i spend like 2 hours trying to translate this sting "I agree to the"

'register_terms' => 'I agree to the ^1terms of service^2.',


i did every thing

i make sure i am editing the same file.

i did create qa-tos-lang-ar.php and translate 'register_terms'

i hard code it in qa-tos-lang-default.php

purged cloudflare cache

deleted all files of Q2A and re-upload them

NO matter what i did the first value i translate to, stick!!

Q2A version: https://github.com/pupi1985/question2answer/tree/bugfix-pupi1985
Also i tried to delete the plugin by deleting the folder from qa-plugin/q2a-tos-1.0.0, But when i reload i still see the checkbox and the 'register_terms'
Please edit your question and show the content of your translation file. Without that we can't see if there might be a problem with it. Also, please double-check that you used UTF-8 encoding *without BOM* for the file.
A potential gotcha with the language file is that the plugin ignores the text between the markers ^1 and ^2 and uses the page title instead. I should probably fix that.

1 Answer

0 votes

Question2Answer (Q2A) handles language translation differently from other software like Wordpress, where .mo and .po files are used. Q2A uses PHP files for different languages which have an array of strings that are used throughout the platform.

Here is a general outline of how to create and use a language file in Q2A:

  1. Create a new PHP file for your language. In your case, you created qa-tos-lang-ar.php for Arabic. Make sure the file is in the same directory as the qa-tos-lang-default.php file.

  2. The contents of this file should look like this:

phpCopy code

<?php return array( 'register_terms' => 'Your translation here', //... other terms go here );

Replace 'Your translation here' with your actual translation.

  1. Make sure your translation file has the same terms as the default language file.

  2. Finally, Q2A needs to be told to use your new language file. Go to the Q2A admin panel, then click on "General" from the left navigation. Scroll down until you see the section for languages. Choose your new language from the dropdown and save the settings.