forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes openemr#7621 validation save errors w/ translations The translation system was not setup in the OnSiteDocumentController and a bug in utility.js would blow up preventing the questionnaire from saving. I added more safety checks to the xl translation function. Injected the language translations into the OnSiteDocumentController and abstracted the language definition retrievals into a service utility class. * Update copyright with correct verbiage. * Accidently had commented out line
- Loading branch information
Showing
5 changed files
with
63 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
/** | ||
* Helper class for dealing with language translations. | ||
* | ||
* @package OpenEMR | ||
* @link https://www.open-emr.org | ||
* @author Jerry Padgett <sjpadgett@gmail.com> | ||
* @author Stephen Nielson <snielson@discoverandchange.com> | ||
* @copyright Copyright (c) 2016-2024 Jerry Padgett <sjpadgett@gmail.com> | ||
* @copyright Copyright (c) 2024 Open Plan IT Ltd. <support@openplanit.com> | ||
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 | ||
*/ | ||
|
||
namespace OpenEMR\Services\Utils; | ||
|
||
class TranslationService | ||
{ | ||
public static function getLanguageDefinitionsForSession() | ||
{ | ||
$language = $_SESSION['language_choice'] ?? '1'; // defaults english | ||
return self::getLanguageDefinitionsForLanguage($language); | ||
} | ||
|
||
public static function getLanguageDefinitionsForLanguage(int $languageId) | ||
{ | ||
$sql = "SELECT c.constant_name, d.definition FROM lang_definitions as d | ||
JOIN lang_constants AS c ON d.cons_id = c.cons_id | ||
WHERE d.lang_id = ?"; | ||
$tarns = sqlStatement($sql, $languageId); | ||
$language_defs = array(); | ||
while ($row = SqlFetchArray($tarns)) { | ||
$language_defs[$row['constant_name']] = $row['definition']; | ||
} | ||
return $language_defs; | ||
} | ||
} |