mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2025-12-25 18:47:53 -05:00
* Improve code style and PSR-12 compliance - refactored code formatting to adhere to PSR-12 guidelines - standardized coding conventions across the codebase - added missing framework files and reverted markup changes - reformatted arrays for enhanced readability - updated language files for consistent styling and clarity - minor miscellaneous improvements
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\Libraries;
|
|
|
|
use CodeIgniter\Language\Language;
|
|
|
|
class MY_Language extends Language
|
|
{
|
|
|
|
public function getLine(string $line, array $args = [])
|
|
{
|
|
// If no file is given, just parse the line
|
|
if (! str_contains($line, '.')) {
|
|
return $this->formatMessage($line, $args);
|
|
}
|
|
|
|
// Parse out the file name and the actual alias.
|
|
// Will load the language file and strings.
|
|
[$file, $parsedLine] = $this->parseLine($line, $this->locale);
|
|
|
|
$output = $this->getTranslationOutput($this->locale, $file, $parsedLine);
|
|
|
|
if ($output === NULL && strpos($this->locale, '-')) {
|
|
[$locale] = explode('-', $this->locale, 2);
|
|
|
|
[$file, $parsedLine] = $this->parseLine($line, $locale);
|
|
|
|
$output = $this->getTranslationOutput($locale, $file, $parsedLine);
|
|
}
|
|
|
|
// If still not found, try English
|
|
if ($output === NULL || $output === "") {
|
|
[$file, $parsedLine] = $this->parseLine($line, 'en');
|
|
|
|
$output = $this->getTranslationOutput('en', $file, $parsedLine);
|
|
}
|
|
|
|
$output ??= $line;
|
|
|
|
return $this->formatMessage($output, $args);
|
|
}
|
|
}
|