Skip to content

Role display names should use i18n system instead of static config #112

Description

@boguslawwitek

Summary

Role display names (Leader, Officer, Member) are currently loaded from server.json config via FactionsConfig.getRoleDisplayName() as static strings. This means they cannot be translated per-player based on their language preference.

Current behavior

server.json:

"roles": {
  "LEADER": { "displayName": "Leader" },
  "OFFICER": { "displayName": "Officer" },
  "MEMBER": { "displayName": "Member" }
}

ConfigManager.getRoleDisplayName(role) returns a single string regardless of the viewer's language. This affects the members list GUI, player info page, promote/demote messages, and anywhere else getRoleDisplayName() is called.

Expected behavior

Role display names should go through the .lang i18n system (e.g. role.leader, role.officer, role.member keys) so they are resolved per-player locale, just like all other user-facing strings.

Example pl-PL/hyperfactions.lang:

role.leader = Przywodca
role.officer = Oficer
role.member = Czlonek

en-US/hyperfactions.lang:

role.leader = Leader
role.officer = Officer
role.member = Member

Context

We run a Polish/English bilingual server with usePlayerLanguage: true. All HyperFactions messages respect player locale, except role names which are hardcoded from config. Setting displayName to Polish in config means English-speaking players see Polish role names, and vice versa.

Additional note

The faction_info.ui layout has #LeaderLabel with Anchor: (Width: 65) which is too narrow for longer translations like Polish Przywodca: (10 chars vs English Leader: 7 chars), causing the label to overlap with the player name. This should also be adjusted (or made dynamic) when adding i18n support for role names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions