Changed all translation to use new TransContext

This commit is contained in:
2025-05-26 08:32:07 -05:00
parent 44dd3b7aa6
commit c1d8dd46d8
14 changed files with 128 additions and 69 deletions

View File

@@ -32,16 +32,4 @@ func getItem(type:Item.Type) -> Item:
return ITEM_MAP[type]
func isStackable(itemType:Item.Type) -> bool:
return getItem(itemType).stackable
func getItemName(itemType:Item.Type, count:int = 1) -> String:
var item = getItem(itemType)
return tr_n(item.title, item.title + "_plural", count).format({
"count": count
})
func getItemDescription(itemType:Item.Type) -> String:
return getItem(itemType).description_text
func getItemCategory(itemType:Item.Type) -> Item.Category:
return getItem(itemType).category
return getItem(itemType).stackable

View File

@@ -44,8 +44,9 @@ func _enter_tree() -> void:
print("Hello World!")
var ctx = TransContext.new()
ctx.addContext("item", ITEM.getItem(Item.Type.POTION).getTranslationContext())
print(ctx.translate("test"))
ctx.addInteger("quantity", 2)
ctx.addContext("item", ITEM.getItem(Item.Type.POTION).getTransContext())
print(ctx.trans("test"))
func setLocaleFromLocaleString(localeString:String) -> void:
var parts:PackedStringArray = localeString.split("_")