Added a few translation helpers
This commit is contained in:
BIN
locale/en_AU.mo
BIN
locale/en_AU.mo
Binary file not shown.
@@ -64,8 +64,11 @@ msgstr[1] "Received {quantity} {item}."
|
||||
msgid "quest.test_quest.title"
|
||||
msgstr "Test Quest"
|
||||
|
||||
msgid "quest.test_quest.objective_onion.title"
|
||||
msgstr "Savenge an Onion"
|
||||
msgid "quest.test_quest.onion.title"
|
||||
msgstr "Scavenge Onions"
|
||||
|
||||
msgid "quest.test_quest.onion.description"
|
||||
msgstr "Find and collect {quantity} {item} and bring them back to {npc}."
|
||||
|
||||
#
|
||||
# ITEMS
|
||||
|
@@ -116,7 +116,7 @@ run={
|
||||
|
||||
[internationalization]
|
||||
|
||||
locale/translations=PackedStringArray("res://locale/en_AU.mo")
|
||||
locale/translations=PackedStringArray("res://locale/en_AU.po")
|
||||
locale/language_filter=["ja"]
|
||||
locale/country_filter=["JP"]
|
||||
|
||||
|
@@ -17,5 +17,9 @@ metadata/_custom_type_script = "uid://dn0kxbe85n40f"
|
||||
|
||||
[node name="Find Onion" type="Node" parent="Quests/Test Quest"]
|
||||
script = ExtResource("3_l8p7p")
|
||||
title = "quest.test_quest.objective_onion.title"
|
||||
title = "quest.test_quest.onion.title"
|
||||
description = "quest.test_quest.onion.description"
|
||||
objectiveType = null
|
||||
itemType = 2
|
||||
quantity = 2
|
||||
metadata/_custom_type_script = "uid://de1ao4huhy0hm"
|
||||
|
@@ -81,3 +81,4 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
text = "Quest Objective Information"
|
||||
autowrap_mode = 2
|
||||
|
@@ -1,6 +1,6 @@
|
||||
class_name Quest extends Node
|
||||
|
||||
@export var title:String = ""
|
||||
@export_multiline var title:String = ""
|
||||
@export var questKey:QuestSystem.QuestKey = QuestSystem.QuestKey.TEST_QUEST
|
||||
|
||||
var questStarted:bool = false
|
||||
@@ -28,4 +28,8 @@ func isStarted() -> bool:
|
||||
return questStarted
|
||||
|
||||
func objectiveUpdated(objective:QuestObjective) -> void:
|
||||
QUEST.questUpdated.emit(self)
|
||||
QUEST.questUpdated.emit(self)
|
||||
|
||||
func getLocaleData() -> Dictionary[String, String]:
|
||||
var dict: Dictionary[String, String] = {}
|
||||
return dict
|
||||
|
@@ -4,7 +4,8 @@ enum Type {
|
||||
Item,
|
||||
}
|
||||
|
||||
@export var title:String = ""
|
||||
@export_multiline var title:String = ""
|
||||
@export_multiline var description:String = ""
|
||||
@export var objectiveType:Type = Type.Item
|
||||
|
||||
@export var itemType:Item.Type = Item.Type.POTION
|
||||
@@ -38,3 +39,9 @@ func _onPlayerInventoryUpdated() -> void:
|
||||
|
||||
func isCompleted() -> bool:
|
||||
return completed
|
||||
|
||||
func getLocaleData() -> Dictionary[String, String]:
|
||||
var dict:Dictionary[String, String] = {}
|
||||
dict.item = ITEM.getItemName(itemType, quantity)
|
||||
dict.quantity = LOCALE.formatInteger(quantity)
|
||||
return dict
|
||||
|
@@ -104,3 +104,6 @@ func setLocale(language:Language, region:Region) -> void:
|
||||
TranslationServer.set_locale(l)
|
||||
localeChanged.emit(l)
|
||||
print("Locale set to: " + l)
|
||||
|
||||
func formatInteger(integer:int) -> String:
|
||||
return TextServerManager.get_primary_interface().format_number(str(integer))
|
||||
|
@@ -61,8 +61,11 @@ func setQuestObjective(objective = null):
|
||||
var quest = QUEST.quests[currentQuestKey];
|
||||
var questObjective = quest.objectives[objective]
|
||||
questObjectiveList.select(objective)
|
||||
|
||||
questObjectiveInfo.text = questObjective.title + "\n"
|
||||
|
||||
# Setup Description
|
||||
var data = quest.getLocaleData()
|
||||
data.merge(questObjective.getLocaleData())
|
||||
questObjectiveInfo.text = tr(questObjective.description).format(data)
|
||||
|
||||
|
||||
func open(questKey = null) -> void:
|
||||
@@ -77,19 +80,13 @@ func close() -> void:
|
||||
func isOpen() -> bool:
|
||||
return self.visible
|
||||
|
||||
|
||||
# Private methods
|
||||
func _updateQuestList():
|
||||
questList.clear()
|
||||
questList.deselect_all()
|
||||
for questKey in QUEST.quests:
|
||||
var q = QUEST.quests[questKey]
|
||||
var n = q.title;
|
||||
if q.isCompleted():
|
||||
n += " (Complete)"
|
||||
elif q.isStarted():
|
||||
n += " (Started)"
|
||||
questList.add_item(n)
|
||||
questList.add_item(q.title)
|
||||
|
||||
|
||||
# Event handlers
|
||||
|
Reference in New Issue
Block a user