# give/4.16.9/src/ThirdPartySupport/WPML/Helpers/WPML.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.16.9. 35 lines.

- Page: https://pluginprobe.com/plugins/give/4.16.9/code/src/ThirdPartySupport/WPML/Helpers/WPML.php
- Raw: https://pluginprobe.com/plugins/give/4.16.9/raw/src/ThirdPartySupport/WPML/Helpers/WPML.php
- Modified: 2025-02-26T22:53:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.16.9/code/src/ThirdPartySupport/WPML/Helpers/WPML.php#L10-L20`.

```php
<?php

namespace Give\ThirdPartySupport\WPML\Helpers;

use SitePress;
use WPML_Request;

/**
 * @since 3.22.0
 */
class WPML
{
    /**
     * @since 3.22.0
     */
    public static function getLocale(): string
    {
        $locale = get_locale();

        /**
         * @var WPML_Request $wpml_request_handler
         * @var SitePress    $sitepress
         */
        global $wpml_request_handler, $sitepress;

        if (isset($wpml_request_handler) && isset($sitepress)) {
            $requestedLang = $wpml_request_handler->get_requested_lang();
            $wpmlLocale = $sitepress->get_locale($requestedLang);
            $locale = $wpmlLocale != $locale ? $wpmlLocale : $locale;
        }

        return $locale;
    }
}

```
