diff --git a/config.lua b/config.lua index 5ceba92..25273f6 100644 --- a/config.lua +++ b/config.lua @@ -9,6 +9,15 @@ activityTimeout = 60, dropDirection = "forward" }, + lang = { + footer = "/pay @%name% ", + refundRemaining = "Here is the funds remaining after your purchase!", + refundOutofStock = "Sorry, that item is out of stock!", + refundAtLeastOne = "You must purchase at least one of this product!", + refundInvalidProduct = "You must supply a valid product to purchase!", + refundNoProduct = "You must supply a product to purchase!", + refundError = "An error occurred while processing your purchase!" + }, theme = { formatting = { headerAlign = "center", diff --git a/core/ConfigValidator.lua b/core/ConfigValidator.lua index f582ff3..88f606e 100644 --- a/core/ConfigValidator.lua +++ b/core/ConfigValidator.lua @@ -11,6 +11,15 @@ activityTimeout = "number", dropDirection = "enum<'forward' | 'up' | 'down' | 'north' | 'south' | 'east' | 'west'>: direction" }, + lang = { + footer = "string", + refundRemaining = "string", + refundOutofStock = "string", + refundAtLeastOne = "string", + refundInvalidProduct = "string", + refundNoProduct = "string", + refundError = "string" + }, theme = { formatting = { headerAlign = "enum<'left' | 'center' | 'right'>: alignment", diff --git a/core/ShopState.lua b/core/ShopState.lua index 3b0ef05..8fbc792 100644 --- a/core/ShopState.lua +++ b/core/ShopState.lua @@ -123,19 +123,19 @@ end purchasedProduct.quantity = purchasedProduct.quantity - available if refundAmount > 0 then - refund(transactionCurrency, transaction.from, meta, refundAmount, "Here is the funds remaining after your purchase!") + refund(transactionCurrency, transaction.from, meta, refundAmount, state.config.lang.refundRemaining) end else - refund(transactionCurrency, transaction.from, meta, transaction.value, "Sorry, that item is out of stock!") + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundOutOfStock) end else - refund(transactionCurrency, transaction.from, meta, transaction.value, "Sorry, that item is out of stock!") + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundOutOfStock) end else - refund(transactionCurrency, transaction.from, meta, transaction.value, "You must purchase at least one of this product!", true) + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundAtLeastOne, true) end else - refund(transactionCurrency, transaction.from, meta, transaction.value, "Must supply a valid product to purchase!", true) + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundInvalidProduct, true) end end @@ -190,11 +190,11 @@ if success then -- Success :D else - refund(transactionCurrency, transaction.from, meta, transaction.value, "An error occurred while processing your purchase!", true) + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundError, true) error(err) end else - refund(transactionCurrency, transaction.from, meta, transaction.value, "Must supply a product to purchase!", true) + refund(transactionCurrency, transaction.from, meta, transaction.value, state.config.lang.refundNoProduct, true) end end end diff --git a/radon.lua b/radon.lua index d0b7c59..4e6aed1 100644 --- a/radon.lua +++ b/radon.lua @@ -111,8 +111,13 @@ header } + local footerMessage = props.config.lang.footer + if footerMessage:find("%%name%%") then + footerMessage = footerMessage:gsub("%%name%%", props.shopState.selectedCurrency.name) + end + if props.shopState.selectedCurrency then - local footer = SmolText { display=display, text="/pay @" .. props.shopState.selectedCurrency.name .. " ", x=1, y=display.bgCanvas.height-smolFont.height-4, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } + local footer = SmolText { display=display, text=footerMessage, x=1, y=display.bgCanvas.height-smolFont.height-4, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } table.insert(flatCanvas, footer) end