/** * Check language validity checker * * @since 1.0.0 * * @covers ::isSupportedLanguage * @small * * @dataProvider languagesProvider * * @param string $language_code language code to test * @param bool $is_valid validity expectation of the passed language * @param string $message error message * * @return void */ public function testIsSupportedLanguage($language_code, $is_valid, $message = '') { if ($is_valid) { $this->assertTrue(\Twitter\Widgets\Language::isSupportedLanguage($language_code), $message); } else { $this->assertFalse(\Twitter\Widgets\Language::isSupportedLanguage($language_code), $message); } }
/** * Explicitly set a Twitter-supported language code for translatable strings in a button or widget * * @since 1.0.0 * * @uses \Twitter\Widgets\Language::isSupportedLanguage verify language parameter before saving * * @param string $lang Twitter-supported language code * * @return __CLASS__ support chaining */ public function setLanguage($lang) { if ($lang && \Twitter\Widgets\Language::isSupportedLanguage($lang)) { $this->lang = $lang; } return $this; }