From f800f39083a429804a961f17644af69eed3eaf1c Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 22 Jun 2014 00:34:35 +0200 Subject: [PATCH] More tooltips and translations. --- internal.lua | 38 ++++++++++++++++++--------- locale/de.txt | 26 ++++++++++++++++--- locale/es.txt | 26 ++++++++++++++++--- locale/pl.txt | 54 +++++++++++++++++++++++++------------- locale/template.txt | 26 ++++++++++++++++--- register.lua | 33 +++++++++++------------- waypoints.lua | 63 +++++++++++++++++++++++++-------------------- 7 files changed, 178 insertions(+), 88 deletions(-) diff --git a/internal.lua b/internal.lua index c35bd4c..ac5abd4 100644 --- a/internal.lua +++ b/internal.lua @@ -65,20 +65,34 @@ function unified_inventory.get_formspec(player, page) -- Controls to flip items pages local start_x = 9.2 - formspec = formspec .. "image_button["..(start_x + 0.6 * 0)..",9;.8,.8;ui_skip_backward_icon.png;start_list;]" - formspec = formspec .. "image_button["..(start_x + 0.6 * 1)..",9;.8,.8;ui_doubleleft_icon.png;rewind3;]" - formspec = formspec .. "image_button["..(start_x + 0.6 * 2)..",9;.8,.8;ui_left_icon.png;rewind1;]" - formspec = formspec .. "image_button["..(start_x + 0.6 * 3)..",9;.8,.8;ui_right_icon.png;forward1;]" - formspec = formspec .. "image_button["..(start_x + 0.6 * 4)..",9;.8,.8;ui_doubleright_icon.png;forward3;]" - formspec = formspec .. "image_button["..(start_x + 0.6 * 5)..",9;.8,.8;ui_skip_forward_icon.png;end_list;]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 0) + .. ",9;.8,.8;ui_skip_backward_icon.png;start_list;;;;;" + .. minetest.formspec_escape(S("First page")) .. "]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 1) + .. ",9;.8,.8;ui_doubleleft_icon.png;rewind3;;;;;" + .. minetest.formspec_escape(S("Back three pages")) .. "]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 2) + .. ",9;.8,.8;ui_left_icon.png;rewind1;;;;;" + .. minetest.formspec_escape(S("Back one page")) .. "]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 3) + .. ",9;.8,.8;ui_right_icon.png;forward1;;;;;" + .. minetest.formspec_escape(S("Forward one page")) .. "]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 4) + .. ",9;.8,.8;ui_doubleright_icon.png;forward3;;;;;" + .. minetest.formspec_escape(S("Forward three pages")) .. "]" + formspec = formspec .. "image_button[" .. (start_x + 0.6 * 5) + .. ",9;.8,.8;ui_skip_forward_icon.png;end_list;;;;;" + .. minetest.formspec_escape(S("Last page")) .. "]" -- Search box - formspec = formspec .. "field[9.5,8.325;3,1;searchbox;;"..minetest.formspec_escape(unified_inventory.current_searchbox[player_name]).."]" - formspec = formspec .. "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]" + formspec = formspec .. "field[9.5,8.325;3,1;searchbox;;" + .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" + formspec = formspec .. "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;;;;;" + .. S("Search") .. "]" -- Items list if #unified_inventory.filtered_items_list[player_name] == 0 then - formspec = formspec.."label[8.2,0;No matching items]" + formspec = formspec.."label[8.2,0;" .. S("No matching items") .. "]" else local dir = unified_inventory.active_search_direction[player_name] local list_index = unified_inventory.current_index[player_name] @@ -100,11 +114,11 @@ function unified_inventory.get_formspec(player, page) end end end - formspec = formspec.."label[8.2,0;Page:]" - formspec = formspec.."label[9,0;"..page.." of "..pagemax.."]" + formspec = formspec.."label[8.2,0;"..S("Page") .. ": " + .. S("%s of %s"):format(page,pagemax).."]" end if unified_inventory.activefilter[player_name] ~= "" then - formspec = formspec.."label[8.2,0.4;Filter:]" + formspec = formspec.."label[8.2,0.4;" .. S("Filter") .. ":]" formspec = formspec.."label[9,0.4;"..minetest.formspec_escape(unified_inventory.activefilter[player_name]).."]" end return formspec diff --git a/locale/de.txt b/locale/de.txt index a0bd6b0..9f12d8c 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -11,9 +11,17 @@ Medium Bag = Rucksack (mittel) Large Bag = Rucksack (gross) ### inernal.lua ### -Page: = Seite: +First page = +Back three pages = +Back one page = +Forward one page = +Forward three pages = +Last page = +No matching items = +Page = Seite %s of %s = %s von %s -Filter: = Suche: +Filter = Suche +Search = ### register.lua ### Can use the creative inventory = Kann das Kreativinventar nutzen @@ -21,7 +29,7 @@ Home position set to: %s = Ausgangsposition nach: %s gesetzt Time of day set to 6am = Tageszeit auf 6 Uhr morgens geaendert You don't have the settime priviledge! = Du hast nicht das "settime" Privileg! Time of day set to 9pm = Tageszeit auf 9 Uhr abends geaendert -This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = Diese Funktion ist ausserhalb des Kreativmodus deaktiviert um ein versehentliches Loeschen des ganzen Inventars zu verhindern. Nutze stattdessen das Muellfeld. +This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = Diese Funktion ist ausserhalb des Kreativmodus deaktiviert um ein versehentliches Loeschen des ganzen Inventars zu verhindern.\nNutze stattdessen das Muellfeld. Inventory Cleared! = Inventar geleert! Crafting = Bauen Trash: = Muell: @@ -37,6 +45,7 @@ Copy to craft grid: = Kopiere ins Baufeld: All = Alles Recipe %s of %s = Rezept %s von %s Alternate = Alternative +Crafting Grid = ### waypoints.lua ### White = @@ -50,4 +59,13 @@ Waypoint inactive = World position = Name = HUD text color = -Toggle waypoint = +Edit waypoint name = +Rename waypoint = +Change color of waypoint display = +Set waypoint to current location = +Make waypoint visible = +Make waypoint invisible = +Disable display of waypoint coordinates = +Enable display of waypoint coordinates = +Finish editing = +Select Waypoint #%d = diff --git a/locale/es.txt b/locale/es.txt index 85df602..9382c79 100644 --- a/locale/es.txt +++ b/locale/es.txt @@ -12,9 +12,17 @@ Medium Bag = Bolsa Mediana Large Bag = Bolsa Grande ### inernal.lua ### -Page: = Página: +First page = +Back three pages = +Back one page = +Forward one page = +Forward three pages = +Last page = +No matching items = +Page = Página %s of %s = %s de %s -Filter: = Filtro: +Filter = Filtro +Search = ### register.lua ### Can use the creative inventory = Puede usar el inventario creativo @@ -22,7 +30,7 @@ Home position set to: %s = Posición de hogar cambiada a: %s Time of day set to 6am = Hora del día cambiada a 6AM You don't have the settime priviledge! = ¡No tienes el privilegio `settime'! Time of day set to 9pm = Hora del día cambiada a 9PM -This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = Éste botón ha sido deshabilitado para prevenir la destrucción accidental del inventario. Usa la ranura para basura en su lugar. +This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = Éste botón ha sido deshabilitado para prevenir la destrucción accidental del inventario.\nUsa la ranura para basura en su lugar. Inventory Cleared! = ¡Inventario limpio! Crafting = Elaboración Trash: = Basura: @@ -38,6 +46,7 @@ Copy to craft grid: = Copiar al cuadro de elaboración All = Todos Recipe %s of %s = Receta %s de %s Alternate = Alternar +Crafting Grid = ### waypoints.lua ### White = Blanco @@ -51,4 +60,13 @@ Waypoint inactive = Punto de paso inactivo World position = Posición en el mundo Name = Nombre HUD text color = Color del HUD -Toggle waypoint = (Des)Activar punto +Edit waypoint name = +Rename waypoint = +Change color of waypoint display = +Set waypoint to current location = +Make waypoint visible = +Make waypoint invisible = +Disable display of waypoint coordinates = +Enable display of waypoint coordinates = +Finish editing = +Select Waypoint #%d = diff --git a/locale/pl.txt b/locale/pl.txt index 867baa4..33003d8 100644 --- a/locale/pl.txt +++ b/locale/pl.txt @@ -11,32 +11,41 @@ Medium Bag = Sredni plecak Large Bag = Duzy plecak ### inernal.lua ### -Page: = -%s of %s = -Filter: = +First page = Pierwsza strona +Back three pages = 3 strony w tyl +Back one page = 1 strona w tyl +Forward one page = 1 strona do przodu +Forward three pages = 3 strony do przodu +Last page = Ostatnia strona +No matching items = Brak pasujacych przedmiotow +Page = Strona +%s of %s = %s z %s +Filter = Filtr +Search = Szukaj ### register.lua ### Can use the creative inventory = -Home position set to: %s = -Time of day set to 6am = -You don't have the settime priviledge! = -Time of day set to 9pm = -This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = +Home position set to: %s = Pozycja domowa ustawiona na: %s +Time of day set to 6am = Czas ustawiony na 6:00 +You don't have the settime priviledge! = Nie masz uprawnien do zmiany czasu (settime)! +Time of day set to 9pm = Czas ustawiony na 21:00 +This button has been disabled outside of creative mode to prevent accidental inventory trashing.\nUse the trash slot instead. = Inventory Cleared! = Crafting = -Trash: = -Refill: = +Trash: = Smietnik: +Refill: = Uzupelnianie: Crafting Guide = -Method: = -Result: %s = +Method: = Metoda: +Result: %s = Wynik: %s crafting = shapeless crafting = cooking = alloy cooking = Copy to craft grid: = -All = -Recipe %s of %s = -Alternate = +All = Wszystko +Recipe %s of %s = Recepta %s z %s +Alternate = Alternatywa +Crafting Grid = ### waypoints.lua ### White = Bialy @@ -45,9 +54,18 @@ Red = Czerwony Green = Zielony Blue = Niebieski Waypoints = Punkty orientacyjne -Waypoint active = Punkt wylaczony -Waypoint inactive = Punkt wlaczony +Waypoint active = Punkt wlaczony +Waypoint inactive = Punkt wylaczony World position = Pozycja Name = Nazwa HUD text color = Kolor tekstu HUD -Toggle waypoint = Przelacz punkt +Edit waypoint name = Edytuj nazwe punktu +Rename waypoint = Zmien nazwe punktu +Change color of waypoint display = Zmien kolor punktu +Set waypoint to current location = Ustaw punkt orientacyjny na biezacej pozycji +Make waypoint visible = Pokaz punkt +Make waypoint invisible = Nie pokazuj punktu +Disable display of waypoint coordinates = Pokazuj koordynaty punktu +Enable display of waypoint coordinates = Nie pokazuj koordynatow punktu +Finish editing = Zakoncz edycje +Select Waypoint #%d = Wybierz punkt #%d diff --git a/locale/template.txt b/locale/template.txt index d77a100..ae382e3 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -12,9 +12,17 @@ Medium Bag = Large Bag = ### inernal.lua ### -Page: = +First page = +Back three pages = +Back one page = +Forward one page = +Forward three pages = +Last page = +No matching items = +Page = %s of %s = -Filter: = +Filter = +Search = ### register.lua ### Can use the creative inventory = @@ -22,7 +30,7 @@ Home position set to: %s = Time of day set to 6am = You don't have the settime priviledge! = Time of day set to 9pm = -This button has been disabled outside of creative mode to prevent accidental inventory trashing. Use the trash slot instead. = +This button has been disabled outside of creative mode to prevent accidental inventory trashing.\nUse the trash slot instead. = Inventory Cleared! = Crafting = Trash: = @@ -38,6 +46,7 @@ Copy to craft grid: = All = Recipe %s of %s = Alternate = +Crafting Grid = ### waypoints.lua ### White = @@ -51,4 +60,13 @@ Waypoint inactive = World position = Name = HUD text color = -Toggle waypoint = +Edit waypoint name = +Rename waypoint = +Change color of waypoint display = +Set waypoint to current location = +Make waypoint visible = +Make waypoint invisible = +Disable display of waypoint coordinates = +Enable display of waypoint coordinates = +Finish editing = +Select Waypoint #%d = diff --git a/register.lua b/register.lua index 9be3dbe..bc379ee 100644 --- a/register.lua +++ b/register.lua @@ -29,7 +29,7 @@ trash:set_size("main", 1) unified_inventory.register_button("craft", { type = "image", image = "ui_craft_icon.png", - tooltip = S("Crafting Menu") + tooltip = S("Crafting Grid") }) unified_inventory.register_button("craftguide", { @@ -50,8 +50,7 @@ unified_inventory.register_button("home_gui_set", { minetest.sound_play("dingdong", {to_player=player_name, gain = 1.0}) minetest.chat_send_player(player_name, - "Home position set to: " - ..minetest.pos_to_string(home)) + S("Home position set to: %s"):format(minetest.pos_to_string(home))) end end, }) @@ -78,11 +77,10 @@ unified_inventory.register_button("misc_set_day", { {to_player=player_name, gain = 1.0}) minetest.set_timeofday((6000 % 24000) / 24000) minetest.chat_send_player(player_name, - "Time of day set to 6am") + S("Time of day set to 6am")) else minetest.chat_send_player(player_name, - "You don't have the" - .." settime priviledge!") + S("You don't have the settime priviledge!")) end end, }) @@ -98,11 +96,10 @@ unified_inventory.register_button("misc_set_night", { {to_player=player_name, gain = 1.0}) minetest.set_timeofday((21000 % 24000) / 24000) minetest.chat_send_player(player_name, - "Time of day set to 9pm") + S("Time of day set to 9pm")) else minetest.chat_send_player(player_name, - "You don't have the" - .." settime priviledge!") + S("You don't have the settime priviledge!")) end end, }) @@ -115,10 +112,10 @@ unified_inventory.register_button("clear_inv", { local player_name = player:get_player_name() if not unified_inventory.is_creative(player_name) then minetest.chat_send_player(player_name, - "This button has been disabled outside" + S("This button has been disabled outside" .." of creative mode to prevent" .." accidental inventory trashing." - .." Use the trash slot instead.") + .."\nUse the trash slot instead.")) return end player:get_inventory():set_list("main", {}) @@ -137,10 +134,10 @@ unified_inventory.register_page("craft", { formspec = formspec.."listcolors[#00000000;#00000000]" formspec = formspec.."list[current_player;craftpreview;6,1;1,1;]" formspec = formspec.."list[current_player;craft;2,1;3,3;]" - formspec = formspec.."label[7,2.5;Trash:]" + formspec = formspec.."label[7,2.5;" .. S("Trash:") .. "]" formspec = formspec.."list[detached:trash;main;7,3;1,1;]" if unified_inventory.is_creative(player_name) then - formspec = formspec.."label[0,2.5;Refill:]" + formspec = formspec.."label[0,2.5;" .. S("Refill:") .. "]" formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,3;1,1;]" end return {formspec=formspec} @@ -204,7 +201,7 @@ unified_inventory.register_page("craftguide", { local player_name = player:get_player_name() local formspec = "" formspec = formspec.."background[0,4.5;8,4;ui_main_inventory.png]" - formspec = formspec.."label[0,0;Crafting Guide]" + formspec = formspec.."label[0,0;" .. S("Crafting Guide") .. "]" formspec = formspec.."listcolors[#00000000;#00000000]" local item_name = unified_inventory.current_item[player_name] if not item_name then return {formspec=formspec} end @@ -232,7 +229,7 @@ unified_inventory.register_page("craftguide", { local craft_type = unified_inventory.registered_craft_types[craft.type] or unified_inventory.craft_type_defaults(craft.type, {}) - formspec = formspec.."label[6,3.35;Method:]" + formspec = formspec.."label[6,3.35;" .. S("Method:") .. "]" formspec = formspec.."label[6,3.75;" ..minetest.formspec_escape(craft_type.description).."]" formspec = formspec..stack_image_button(6, 1, 1.1, 1.1, "item_button_usage_", ItemStack(craft.output)) @@ -263,17 +260,17 @@ unified_inventory.register_page("craftguide", { end if craft_type.uses_crafting_grid then - formspec = formspec.."label[6,1.95;Copy to craft grid:]" + formspec = formspec.."label[6,1.95;" .. S("Copy to craft grid:") .. "]" .."button[6,2.5;0.6,0.5;craftguide_craft_1;1]" .."button[6.6,2.5;0.6,0.5;craftguide_craft_10;10]" - .."button[7.2,2.5;0.6,0.5;craftguide_craft_max;All]" + .."button[7.2,2.5;0.6,0.5;craftguide_craft_max;" .. S("All") .. "]" end if alternates and alternates > 1 then formspec = formspec.."label[0,2.6;"..recipe_text[dir].." " ..tostring(alternate).." of " ..tostring(alternates).."]" - .."button[0,3.15;2,1;alternate;Alternate]" + .."button[0,3.15;2,1;alternate;" .. S("Alternate") .. "]" end return {formspec = formspec} end, diff --git a/waypoints.lua b/waypoints.lua index f37abda..7023992 100644 --- a/waypoints.lua +++ b/waypoints.lua @@ -24,42 +24,45 @@ unified_inventory.register_page("waypoints", { -- Tabs buttons: local i for i = 1, 5, 1 do - if i == waypoints.selected then - formspec = formspec .. - "image_button[0.0,".. 0.2 + i*0.7 ..";.8,.8;ui_blue_icon_background.png^ui_".. - i .."_icon.png;select_waypoint".. i .. ";]" - else - formspec = formspec .. - "image_button[0.0,".. 0.2 + i*0.7 ..";.8,.8;ui_".. - i .."_icon.png;select_waypoint".. i .. ";]" - end + formspec = formspec .. + "image_button[0.0,".. 0.2 + i*0.7 ..";.8,.8;".. + (i == waypoints.selected and "ui_blue_icon_background.png^" or "").. + "ui_"..i.."_icon.png;".. + "select_waypoint"..i..";;;;;".. + minetest.formspec_escape(S("Select Waypoint #%d"):format(i)).."]" end i = waypoints.selected -- Main buttons: formspec = formspec .. - "image_button[4.5,3.7;.8,.8;ui_waypoint_set_icon.png;set_waypoint".. i .. ";]" + "image_button[4.5,3.7;.8,.8;".. + "ui_waypoint_set_icon.png;".. + "set_waypoint"..i..";;;;;".. + minetest.formspec_escape(S("Set waypoint to current location")).."]" - if waypoints[i].active then - formspec = formspec .. - "image_button[5.2,3.7;.8,.8;ui_on_icon.png;toggle_waypoint".. i .. ";;;;;"..S("Toggle waypoint").."]" - else - formspec = formspec .. - "image_button[5.2,3.7;.8,.8;ui_off_icon.png;toggle_waypoint".. i .. ";;;;;"..S("Toggle waypoint").."]" - end - - if waypoints[i].display_pos then - formspec = formspec .. - "image_button[5.9,3.7;.8,.8;ui_green_icon_background.png^ui_xyz_icon.png;toggle_display_pos".. i .. ";]" - else - formspec = formspec .. - "image_button[5.9,3.7;.8,.8;ui_red_icon_background.png^ui_xyz_icon.png;toggle_display_pos".. i .. ";]" - end + formspec = formspec .. + "image_button[5.2,3.7;.8,.8;".. + (waypoints[i].active and "ui_on_icon.png" or "ui_off_icon.png")..";".. + "toggle_waypoint"..i..";;;;;".. + minetest.formspec_escape(S("Make waypoint "..(waypoints[i].active and "invisible" or "visible"))).."]" formspec = formspec .. - "image_button[6.6,3.7;.8,.8;ui_circular_arrows_icon.png;toggle_color".. i .. ";]".. - "image_button[7.3,3.7;.8,.8;ui_pencil_icon.png;rename_waypoint".. i .. ";]" + "image_button[5.9,3.7;.8,.8;".. + (waypoints[i].display_pos and "ui_green_icon_background.png" or "ui_red_icon_background.png").."^ui_xyz_icon.png;".. + "toggle_display_pos"..i..";;;;;".. + minetest.formspec_escape(S((waypoints[i].display_pos and "Disable" or "Enable").." display of waypoint coordinates")).."]" + + formspec = formspec .. + "image_button[6.6,3.7;.8,.8;".. + "ui_circular_arrows_icon.png;".. + "toggle_color"..i..";;;;;".. + minetest.formspec_escape(S("Change color of waypoint display")).."]" + formspec = formspec .. + "image_button[7.3,3.7;.8,.8;".. + "ui_pencil_icon.png;".. + "rename_waypoint"..i..";;;;;".. + minetest.formspec_escape(S("Edit waypoint name")).."]" -- Waypoint's info: if waypoints[i].active then @@ -71,7 +74,10 @@ unified_inventory.register_page("waypoints", { if waypoints[i].edit then formspec = formspec .. "field[1.3,3.2;6,.8;rename_box" .. i .. ";;"..waypoints[i].name.."]" .. - "image_button[7.3,2.9;.8,.8;ui_ok_icon.png;confirm_rename".. i .. ";]" + "image_button[7.3,2.9;.8,.8;".. + "ui_ok_icon.png;".. + "confirm_rename"..i.. ";;;;;".. + minetest.formspec_escape(S("Finish editing")).."]" end formspec = formspec .. "label[1,1.3;"..S("World position")..": " .. @@ -87,6 +93,7 @@ unified_inventory.register_page("waypoints", { unified_inventory.register_button("waypoints", { type = "image", image = "ui_waypoints_icon.png", + tooltip = S("Waypoints"), }) unified_inventory.update_hud = function (player, waypoint)