<commit_before><?php

class LangTest extends \Codeception\TestCase\Test
{
	public function testLang()
	{
		$ko = Rhymix\Framework\Lang::getInstance('ko');
		$en = Rhymix\Framework\Lang::getInstance('en');
		$this->assertTrue($ko instanceof Rhymix\Framework\Lang);
		$this->assertTrue($en instanceof Rhymix\Framework\Lang);
		$this->assertFalse($ko === $en);
		
		$ja = Rhymix\Framework\Lang::getInstance('ja');
		$jp = Rhymix\Framework\Lang::getInstance('jp');
		$this->assertTrue($ja === $jp);
		
		$this->assertEquals('도움말', $ko->get('common.help'));
		$this->assertEquals('Help', $en->get('common.help'));
		$this->assertEquals('도움말', $ko->help);
		$this->assertEquals('Help', $en->help);
		
		$this->assertEquals('common.nonexistent', $ko->get('common.nonexistent'));
		$this->assertEquals('common.nonexistent', $ko->get('common.nonexistent', 'foo', 'bar'));
		
		$this->assertEquals('admin.help', $ko->get('admin.help'));
		$this->assertEquals('admin.help', $en->get('admin.help'));
		
		$ja->loadPlugin('common');
		$this->assertEquals('ヘルプ', $ja->help);
		
		$ko->foobartestlang = '%s님 안녕하세요?';
		$this->assertEquals('Travis님 안녕하세요?', $ko->foobartestlang('Travis'));
		$en->foobartestlang = 'Hello, %s!';
		$this->assertEquals('Hello, Travis!', $en->get('foobartestlang', 'Travis'));
	}
}
<commit_msg>Update and expand unit tests for Lang class<commit_after><?php

class LangTest extends \Codeception\TestCase\Test
{
	public function testLang()
	{
		// Test separation of languages.
		$ko = Rhymix\Framework\Lang::getInstance('ko');
		$en = Rhymix\Framework\Lang::getInstance('en');
		$this->assertTrue($ko instanceof Rhymix\Framework\Lang);
		$this->assertTrue($en instanceof Rhymix\Framework\Lang);
		$this->assertFalse($ko === $en);
		
		// Test backward compatible language code for Japanese.
		$ja = Rhymix\Framework\Lang::getInstance('ja');
		$jp = Rhymix\Framework\Lang::getInstance('jp');
		$this->assertTrue($ja === $jp);
		
		// Test loading new plugins.
		$this->assertNotEquals('ヘルプ', $ja->help);
		$ja->loadPlugin('common');
		$this->assertEquals('ヘルプ', $ja->help);
		
		// Test simple translations with namespacing.
		$this->assertEquals('도움말', $ko->get('common.help'));
		$this->assertEquals('Help', $en->get('common.help'));
		
		// Test simple translations without namespacing.
		$this->assertEquals('도움말', $ko->help);
		$this->assertEquals('Help', $en->help);
		
		// Test complex translations with multidimensional arrays.
		$this->assertEquals('%d분 전', $ko->get('common.time_gap.min'));
		$this->assertEquals('10분 전', $ko->get('common.time_gap.min', 10));
		$this->assertTrue($ko->get('common.time_gap') instanceof \ArrayObject);
		$this->assertEquals('%d분 전', $ko->get('common.time_gap')->min);
		
		// Test nonexistent keys.
		$this->assertEquals('common.nonexistent', $ko->get('common.nonexistent'));
		$this->assertEquals('common.nonexistent', $ko->get('common.nonexistent', 'foo', 'bar'));
		$this->assertEquals('admin.help', $ko->get('admin.help'));
		$this->assertEquals('admin.help', $en->get('admin.help'));
		
		// Test fallback to English.
		$en->only_in_english = 'Hello world';
		$this->assertEquals('Hello world', $ko->only_in_english);
		$this->assertEquals('Hello world', $en->only_in_english);
		$this->assertEquals('Hello world', $ja->only_in_english);
		
		// Test string interpolation.
		$ko->foobartestlang = '%s님 안녕하세요?';
		$this->assertEquals('Travis님 안녕하세요?', $ko->foobartestlang('Travis'));
		$en->foobartestlang = 'Hello, %s!';
		$this->assertEquals('Hello, Travis!', $en->get('foobartestlang', 'Travis'));
	}
}

{'fraction_non_alphanumeric': 0.2179523141654979, 'fraction_numerical': 0.0011220196353436186, 'mean_word_length': 5.322695035460993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1191418', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1242, 'n_words': 195}