Skip to content

Commit

Permalink
Babel - Persistent Language Hint for non-primary language (#1324)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike-MF <[email protected]>
Co-authored-by: jonpas <[email protected]>
  • Loading branch information
3 people authored Jul 3, 2024
1 parent 63a34eb commit 16e9c6b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addons/sys_core/fnc_cycleLanguage.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ if (_numSpokenLanguages > 1) then {
if (_nextId > _numSpokenLanguages - 1) then {
_nextId = 0;
};

// Set hint duration to infinite when you're not speaking your first language (setting dependent)
private _hintTime = 1;
if (EGVAR(sys_list,LanguageHintPersist) && {_nextId > 0}) then {
_hintTime = -1;
};

private _languageId = ACRE_SPOKEN_LANGUAGES select _nextId;
private _language = GVAR(languages) select _languageId;
_language params ["_languageKey","_languageName"];
[_languageKey] call FUNC(setSpeakingLanguage);
["acre_cycleLanguage", _languageName, "Now speaking", "", 1, EGVAR(sys_list,LanguageColor)] call EFUNC(sys_list,displayHint);
["acre_cycleLanguage", _languageName, "Now speaking", "", _hintTime, EGVAR(sys_list,LanguageColor)] call EFUNC(sys_list,displayHint);
[] call FUNC(updateSelf);
if (ACRE_LOCAL_SPEAKING) then {
//@TODO: This is an uber hack, should probably be set up as a TS event.
Expand Down
9 changes: 9 additions & 0 deletions addons/sys_list/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ private _fonts = ["EtelkaMonospacePro", "EtelkaMonospaceProBold", "LCD14", "Puri
{}
] call CBA_fnc_addSetting;

// Babel Language Hint Persistence
[
QGVAR(LanguageHintPersist),
"CHECKBOX",
[localize LSTRING(LanguageHintPersist_DisplayName), localize LSTRING(LanguageHintPersist_Description)],
ELSTRING(sys_core,CategoryUI),
true
] call CBA_fnc_addSetting;

// PTT1 Color
[
QGVAR(PTT1Color),
Expand Down
10 changes: 10 additions & 0 deletions addons/sys_list/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@
<Portuguese>Cor: Alternar Idiomas do Babel</Portuguese>
<Turkish>Babel Dil Değiştirme Rengi</Turkish>
</Key>
<Key ID="STR_ACRE_sys_list_LanguageHintPersist_DisplayName">
<English>Persist Babel Language Indicator</English>
<German>Babel Sprachanzeige bleibt sichtbar</German>
<Italian>Indicatore di lingua persistente</Italian>
</Key>
<Key ID="STR_ACRE_sys_list_LanguageHintPersist_Description">
<English>Prevent the Babel Language Indicator in the bottom right from fading out if a language other than the "main language" (the first assigned spoken language) is selected.</English>
<German>Verhindert, wenn eingeschaltet, dass die Babel Sprachanzeige unten-rechts verschwindet während eine andere Sprache als die "Muttersprache" (die erste zugewiesene Sprache) gesprochen wird.</German>
<Italian>Se attivato, l'indicatore della lingua selezionata in basso a destra non scomparirà mentre si parla una lingua diversa da quella "madre" (la prima lingua assegnata).</Italian>
</Key>
<Key ID="STR_ACRE_sys_list_SwitchChannelColor_DisplayName">
<English>Switch Channel Color</English>
<German>Farbe bei Funkkanalwechsel</German>
Expand Down

0 comments on commit 16e9c6b

Please sign in to comment.