What have you tried so far? We can help you get your code working here, but we can't write your code for you: Due to a very limited number of contributors here, we simply cannot offer a "free global code-writing service." The resources in our Apache Forum Charter and the examples in our Apache Forum Library may be quite useful to get you started. Links to both are at the top of this page.
It will be possible to extract the language parameter from the query string and use it as a "back-reference" to create the new URL to which you wish to redirect. So it will not be necessary to 'hard code' a rule for each language case. If desired, the 'test' parameter may be similarly back-referenced to allow the same rule to be used for other query-driven "functions." As this "back-reference" concept is key to achieving your goal, pay particular attention to it when you see it in the cited resources and in the Apache mod_rewrite documentation.
Also, it is often the case that posters here confuse external redirects with internal rewrites and frequently misunderstand the "direction" of mod_rewrite's redirect and/or rewriting action; Be aware that mod_rewrite takes action after a URL is requested by an HTTP client (e.g. browser or search engine robot) from your server, and before any server content is sent in response to that client request. For this reason, mod_rewrite cannot "change the URL" which has already been requested.
Therefore, I should ask you what URL you intend to publish on your Web pages, because that URL is the one which will be listed by search engines and which will appear in the users' browser address bar, and mod_rewrite acts too late in the process to change that URL.
Most of the time, posters here are trying to implement so-called "search-engine-friendly static" URLs, in which case the usual procedure involves three steps, the last of which is optional. Note in particular the distinction between redirects and rewrites, and the 'direction' of these functions:
1) Change all URLs published on your pages from the dynamic form (e.g. www.example.com/application/home/index.php?lang=en&action=test) to the static form (e.g. www.example.com/application/en/home/test). This is done by editing the HTML source for each static HTML page (if those pages are static) or by modifying the script which generates those HTML pages (if they are generated dynamically.)
2) Create a RewriteRule to internally rewrite (not redirect) client requests for the static SEO-friendly URLs to the corresponding internal script filepath plus query string. This internal rewrite is a URL-to-filepath translation.
3) (Optional) Create a RewriteRule to externally redirect only direct client requests for the (old) dynamic URLs to the (new) static URLs to speed up search engines' re-indexing of the new SEO-friendly URLs. This external redirect is a URL-to-URL translation.
The "direct client requests only" proviso in the final step is required in order to avoid an 'infinite' rewrite/redirect loop which will effectively make both the static and dynamic URLs inaccessible, and may take down your server if your site is very busy.
This three-step process is described in some detail in the thread "
Changing Dynamic URLs to Static URLs - Implementing search engine friendly URLs with mod_rewrite [webmasterworld.com]", one of many threads in our Apache Forum Library.
Jim