refactor: deduplicate OS-specific hotkey detection into a shared helper

This commit is contained in:
Ribas160 2026-05-29 15:43:41 +03:00
parent 5d946c52a7
commit ec2d230d1b
No known key found for this signature in database
GPG key ID: ED4AE99DCA25A6BB
5 changed files with 31 additions and 6 deletions

View file

@ -297,6 +297,19 @@ class I18n
return in_array(self::$_language, array('ar', 'he'));
}
/**
* get OS-specific copy hotkey modifier key name based on user agent
*
* @access public
* @static
* @return string 'Cmd' on macOS, 'Ctrl' otherwise
*/
public static function getCopyHotkey()
{
return isset($_SERVER['HTTP_USER_AGENT']) &&
strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ? 'Cmd' : 'Ctrl';
}
/**
* set the default language
*