Coder Social home page Coder Social logo

Add translations about technic HOT 7 CLOSED

minetest-mods avatar minetest-mods commented on August 18, 2024
Add translations

from technic.

Comments (7)

ShadowNinja avatar ShadowNinja commented on August 18, 2024

Yes, we can use kaeza's intllib mod for internationalization. Would you be able to add translations?

from technic.

aracnus avatar aracnus commented on August 18, 2024

I would like to translate it to Brazilian Portuguese.

from technic.

Roberto5 avatar Roberto5 commented on August 18, 2024

yes, i can add translations, i have see on mod more ores, it control if mod intllib is loaded and set the function S, else s=function(s) return s

local S
if (minetest.get_modpath("intllib")) then
        dofile(minetest.get_modpath("intllib").."/intllib.lua")
        S = intllib.Getter(minetest.get_current_modname())
        else
        S = function ( s ) return s end
end

every string must be insert in function S

S("string to translate")
S("my param %s "):format(S("param"))

my hint is to use a translation simbol.
for example

S("GOLD")
S("GOLD_DESC")

locale/en.txt

GOLD = gold
GOLD_DESC = gold is a mineral

is redundant, but we can take en.txt for make easy and total translation

locale/it.txt

GOLD = oro
GOLD_DESC = l'oro รจ un minerale

this is importat edit, i want talk before write

from technic.

ShadowNinja avatar ShadowNinja commented on August 18, 2024

No, that isn't how intllib is used. It should be used like this:
name = S("Gold")
And then in a translation file:
Gold = Aurum
That way if a translation is not found it returns "Gold" and not "GOLD_NAME".
Your usage of format() is also incorrect, it should be used like this:
S("Electric Furnace %s"):format(percent)
That is, you normally don't translate arguments to format, you just translate it in the original string.
Of course in this case you could just use concatenation, format syntax is more useful when you want to embed strings into the middle of a translation.
format() and concatenation should be used for untranslatable strings like numbers, usually that are dynamic.
I am discussing intllib with kaeza right now, and before we add translation files we will need to have support for it in the code.

from technic.

Roberto5 avatar Roberto5 commented on August 18, 2024

in your method we must write on terminal this command
grep -o -r 'S("'.*'")' * > locale/en.txt

for search every string to translate.

from technic.

ShadowNinja avatar ShadowNinja commented on August 18, 2024

@pagliaccio: With your method, yes. We would then have to translate all of the constants. However if a translation is not found the original string is returned, so you have to use real strings.

from technic.

ShadowNinja avatar ShadowNinja commented on August 18, 2024

I have pushed support for intllib. @aracnus and @pagliaccio: You can begin work on your translations. Use locale/template.txt to start. Once you have finished you can pull-request it.

from technic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.