Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python-like localization support #19

Open
WPMGPRoSToTeMa opened this issue Jun 20, 2018 · 0 comments
Open

Python-like localization support #19

WPMGPRoSToTeMa opened this issue Jun 20, 2018 · 0 comments
Labels
enhancement Priority: Medium sourcepawn Related to SorucePawn extension

Comments

@WPMGPRoSToTeMa
Copy link

WPMGPRoSToTeMa commented Jun 20, 2018

Not really python-like, but inspired by it and by #18 of course.

First of all instead of capsing, like DID_DMG_HITS, we can use some default translation text (e.g. english text).
Secondly instead of %L we can use function style: L(player, "He did {damage:d} damage to you with {hits:d} hit(s)\nand still has {health:d}hp and {armor:d}ap.")

This simplifies localization process of plugin that doesn't support it. Look:

Format("He did {damage:d} damage to you with {hits:d} hit(s)\nand still has {health:d}hp and {armor:d}ap."
  , FmtArg("damage", damage)
  , FmtArg("hits", hits)
  , FmtArg("health", player.Health)
  , FmtArg("armor", player.Armor)
);

Becomes:

Format(L(player, "He did {damage:d} damage to you with {hits:d} hit(s)\nand still has {health:d}hp and {armor:d}ap.")
  , FmtArg("damage", damage)
  , FmtArg("hits", hits)
  , FmtArg("health", player.Health)
  , FmtArg("armor", player.Armor)
);

Just adding L(player, and )!

TODO:

  • Plurals
  • SetLanguageContext(player); to remove repetitive player's index in L for localized arguments or using last passed player's index if it isn't passed
  • Translation file auto-creation, on runtime or maybe some source code analyze tool
  • FMTARG macro that will expand FMTARG(var) to FmtArg("var", var)
  • Something that i forgot or don't know about python-like localization
@Amaroq7 Amaroq7 added this to To do in SPMod Jun 22, 2018
@Amaroq7 Amaroq7 added sourcepawn Related to SorucePawn extension Priority: Medium and removed Priority: High labels Oct 2, 2019
@Amaroq7 Amaroq7 added this to To do in SourcePawn Adapter via automation Oct 9, 2019
@Amaroq7 Amaroq7 removed this from To do in SPMod Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Priority: Medium sourcepawn Related to SorucePawn extension
Projects
Development

No branches or pull requests

2 participants