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

Localization key not work when create an item #172

Open
juliusspeak opened this issue Feb 28, 2024 · 1 comment
Open

Localization key not work when create an item #172

juliusspeak opened this issue Feb 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@juliusspeak
Copy link

Not exactly an error, but I had to add this to the code so that the translation works correctly and does not show the key instead translation.

func add_item(item: InventoryItem) -> bool:
	if !can_add_item(item):
		return false

	if item.get_parent():
		item.get_parent().remove_child(item)

	add_child(item)
##############################
	item.set_property("name", tr(item.get_property("name")))
##############################
	if Engine.is_editor_hint():
		item.owner = get_tree().edited_scene_root
	return true
func create_and_add_item(prototype_id: String) -> InventoryItem:
	var item: InventoryItem = InventoryItem.new()
	item.protoset = item_protoset
	item.prototype_id = prototype_id
##############################
	item.set_property("name", tr(item.get_property("name")))
##############################
	if add_item(item):
		return item
	else:
		item.free()
		return null
@peter-kish peter-kish added the bug Something isn't working label Feb 28, 2024
@peter-kish
Copy link
Owner

Yeah, would be nice to have support for localization, though I haven't really done any work on that yet.

I'm also not sure if I will be able to include it in the following releases... My plans are to get version 2.x into a stable state (without adding any ambitious new features), and then focus on version 3 which should include all the features I was postponing in favor of stability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants