Skip to content

Commit

Permalink
Add dative case function to loc manager (#5510)
Browse files Browse the repository at this point in the history
* dative

* slipped it

* slipped it twice
  • Loading branch information
lzk228 authored Nov 5, 2024
1 parent 14d3699 commit 4e100d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Resources/Locale/en-US/_engine_lib.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ zzzz-object-pronoun = { GENDER($ent) ->
*[neuter] it
}
# Used internally by the DAT-OBJ() function.
# Not used in en-US. Created for supporting other languages.
zzzz-dat-object = { GENDER($ent) ->
[male] him
[female] her
[epicene] them
*[neuter] it
}
# Used internally by the POSS-PRONOUN() function.
zzzz-possessive-pronoun = { GENDER($ent) ->
[male] his
Expand Down
11 changes: 11 additions & 0 deletions Robust.Shared/Localization/LocalizationManager.Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private void AddBuiltInFunctions(FluentBundle bundle)
AddCtxFunction(bundle, "GENDER", FuncGender);
AddCtxFunction(bundle, "SUBJECT", FuncSubject);
AddCtxFunction(bundle, "OBJECT", FuncObject);
AddCtxFunction(bundle, "DAT-OBJ", FuncDatObj);
AddCtxFunction(bundle, "POSS-ADJ", FuncPossAdj);
AddCtxFunction(bundle, "POSS-PRONOUN", FuncPossPronoun);
AddCtxFunction(bundle, "REFLEXIVE", FuncReflexive);
Expand Down Expand Up @@ -203,6 +204,16 @@ private ILocValue FuncObject(LocArgs args)
return new LocValueString(GetString("zzzz-object-pronoun", ("ent", args.Args[0])));
}

/// <summary>
/// Returns the dative form pronoun for the entity's gender.
/// This method is intended for languages with a dative case, where indirect objects
/// (e.g., "to him," "for her") require specific forms. Not applicable for en-US locale.
/// </summary>
private ILocValue FuncDatObj(LocArgs args)
{
return new LocValueString(GetString("zzzz-dat-object", ("ent", args.Args[0])));
}

/// <summary>
/// Returns the respective possessive adjective (his, her, their, its) for the entity's gender.
/// </summary>
Expand Down

0 comments on commit 4e100d9

Please sign in to comment.