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

In my User Activity plugin, I create URLs for links like this:

qa_path('user-activity/questions/'.$handle)
and
qa_path('user-activity/answers/'.$handle)

If I use QA_CONST_PATH_MAP I can change the "user-activity" part, e.g.

$QA_CONST_PATH_MAP=array(
    'user-activity' => 'userposts',
);

Now the links show up as "userposts/questions/<user>. But if someone wants to translate the "questions" string I don't see a way to do it. I tried adding this to the path map:

'user-activity/questions' => 'userposts/q',

But it doesn't work. Is it possible to change that in any way?

Q2A version: 1.5.3
by
hello @scott

Did you solved the problem ? Can you share ?

Thanks

1 Answer

0 votes
by

I'm afraid $QA_CONST_PATH_MAP only works on the first part of a URL - sorry about that.

But if this is for a plugin you should be able to have the user set this kind of URL fragment in a regular option. Q2A doesn't adopt that approach because it wants to know the page routing before loading anything from the database.

by
Yeah fair enough. I should be able to put it in the language file, actually.
...