Title: Has translation
Last modified: February 12, 2018

---

# Has translation

 *  Resolved [dcrystalj](https://wordpress.org/support/users/dcrystalj/)
 * (@dcrystalj)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/)
 * Is there function to check if translation for current language for specific field/
   post exists?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/#post-9966363)
 * Hi [@dcrystalj](https://wordpress.org/support/users/dcrystalj/)
    You can use `
   wpm_is_ml_string()` for check if it is multilingual string. Then You can use `
   preg_match` for find multilinagual tag for needed language.
 *  Thread Starter [dcrystalj](https://wordpress.org/support/users/dcrystalj/)
 * (@dcrystalj)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/#post-9986517)
 * Thank you.
 * I managed to write helper for this:
 *     ```
       		function wpm_trans_exists($str, $lang) {
       			if (!wpm_is_ml_string($str)) {
       				return false;
       			}
       			preg_match('/\[:'. $lang .'\]/', $str, $matches, PREG_OFFSET_CAPTURE, 0);
       			return count($matches) > 0;
       		}
       ```
   
 * do you know how can i get current selected language string? like ‘en’ ?
    -  This reply was modified 8 years, 4 months ago by [dcrystalj](https://wordpress.org/support/users/dcrystalj/).
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/#post-9988450)
 * Hi [@dcrystalj](https://wordpress.org/support/users/dcrystalj/)
    What language
   are You need? Current localization language or current edit language? For get
   current language, You can use ‘wpm_get_language()’. For get current edit language(
   only in admin) You can use: `$edit_lang = !empty($_GET['edit_lang']) ? $_GET['
   edit_lang'] : get_user_meta( get_current_user_id(), 'edit_lang', true );`.
    -  This reply was modified 8 years, 4 months ago by [VaLeXaR](https://wordpress.org/support/users/valexar/).
 *  Thread Starter [dcrystalj](https://wordpress.org/support/users/dcrystalj/)
 * (@dcrystalj)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/#post-9991993)
 * thank you sir!
 * `wpm_get_language` saved my day. You really should add this function to github
   readme/docs
    -  This reply was modified 8 years, 4 months ago by [dcrystalj](https://wordpress.org/support/users/dcrystalj/).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Has translation’ is closed to new replies.

 * ![](https://ps.w.org/wp-multilang/assets/icon-256x256.png?rev=1760406)
 * [WP Multilang - Translation and Multilingual Plugin](https://wordpress.org/plugins/wp-multilang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-multilang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-multilang/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-multilang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-multilang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-multilang/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [dcrystalj](https://wordpress.org/support/users/dcrystalj/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/has-translation/#post-9991993)
 * Status: resolved