Localisation of Gruescript

So, ok, let’s use this thread for our efforts localizing Gruescript to other languages.

I have Cloak of darkness already translate to Spanish. But of course, as is, the game shows a lot of messages in English. Maybe they are hardcoded, or maybe they are in a table of system messages. That last thing would ease our work on it a lot. Or, if those messages can’t be still modified in-script we can help to build whatever system that allows customizing all hardcoded messages.

Another idea is to use .gru libraries that we can import into our games, so authors do have not to copy and paste the new language definitions on each game. Having a spanish.gru, french.gru italian.gru that overrides the default system messages could be really nice.

I know Robin says it is open source and such, but I think a proper official system (although contributed by us) for changing the language could benefit a lot the system.

Anyway… let’s start, I have already some doubts.

6 Likes

ok, first doubt.

I’ve tried to use def and indef to define the articles for objets, so they read in spanish, instead the english ‘the’

How those must be used? I’ve tried like this without luck:

un objeto portable

thing manto manto de ópera negro como la noche
carried # comienza en el inventario
def “el”
indef “un”
tags portable wearable worn

But it seems is not the proper syntax, if fails when building the game. Help! Thanks!

I don’t know any Spanish, but I’ll help as much as I can:

Firstly, “def” and “indef” are properties; they don’t hand a shorthand syntax, they’re set with prop. Secondly, they specify not just the article, but the whole noun phrase. So, if I’m guessing the Spanish correctly, that should be something like

thing manto
carried
prop def el manto
prop indef un manto

This allows you to change the ending or any other part of the word itself, in languages that do that. It seems to be working as expected for me.

(Also, you shouldn’t be using double-quotes anywhere in Gruescript, unless you want them to be printed.)

1 Like

Yeah, thanks, that worked really fine!

Ok, more questions. Is there anyway to change the text asociated with a system verb or system property or system whatever, from the script?

For example, I know I can just define in a room:

dir norte patio_castillo
dir sur entrada
dir este torreon
dir oeste barracas

and with that I have already spanish directions.

But I wonder if there is a way to chaneg the text of an official direction to "translate it ", or just customise. Imagine someone would want a very oddly phrased game with “northward” instead of “north”.

Maybe it is possible to do sometihng like

verb north northward

?

This is not a critical thing to have, because I could just set my own directions within the room properties, and your system is already quite robust. See, this works perfectly:

room vestibulo Estás en el vestíbulo de la Ópera.
tags start
dir sur bar
dir oeste guardarropa
dir norte vestibulo

bloquear una salida

verb go norte
at vestibulo
say ¡Pero si acabas de llegar!

What are you hoping to do that you can’t do with the dir lines? If I wanted to make a game with different directions, that’s how I’d do it.

In the unlikely event that someone put a gun to my head and told me to do it another way, I might use an intransitive verb (a new feature as of this morning!):

setverb northward intransitive
!eq $room.dir.north 0 # activate whenever the room has a 'north' exit

verb northward
goto $room.dir.north

but it’s not a good solution: the “northward” button will appear after “Actions:”, not “Exits:”, the ordinary “north” button will still be there, and moving north in this way won’t be caught by verb go north.

Or I suppose you could use a CSS hack to change the text on the direction buttons, which is left as an exercise for the reader.

The dir lines allow me to have the exits in spanish!

Take a look:

1 Like

I’ve now abstracted, I THINK, all the English default messages and button labels. They can be overridden by using a localise (or localize) line in the game block, like

game Das Luftkissenboot
localise its_dark Es ist dunkel. # (etc, etc)

The full list of localisation keys (48 at my last count) is in the documentation on github at https://github.com/robindouglasjohnson/gruescript/blob/main/docs/gruescript.md#appendix-ii-localisation (but not yet in the nice PDF documentation on itch.)

With this, and manipulation of verb display properties, I think almost any message in a Gruescript game should now be customisable/localisable – the exception is lists of room contents (if you have “List room contents in scroller” enabled in the game options), which can change the word “and” to something else but can’t change the grammar of the list. I don’t really know how many languages that’s adequate for.

Of course, so far this only allows you to set the messages for one language and make a game in that language. If you wanted to produce your game in several languages, you’d have to change all the localise lines and re-export it for each of them. So what you SHOULD be able to do (but can’t yet!) is something like this:

# localise german its_dark Es ist dunkel.
# localise french its_dark C'est darque! # sorry, I don't actually know any French

which is probably the next thing I’ll do.

You can also now use display and prompt on the pseudo-verb “go” for directions, meaning you could do

verb go south
display sur
continue

rather than use an author-defined direction.

It’s likely there are other things I haven’t thought of, and I’m happy to hear them.

4 Likes

This is quite awesome!

I’m gonna finish that El manto de la oscuridad, so you can upload it as an example for games in Spanish!

The system sounds good to me. The only nitpicking I find is that games blocks would be long long affairs, so that’s why I was recommending some kind of INCLUDE command, that allows us to import the localization of a language.

But at first, I didn’t think about have multiple games for each game, but that is a really good idea! but again, would produce very long source codes, again, that could be cleaned up with an external include of source code. Or maybe an alternative system to upload different localisations a-la Inform, where the localisations are semi-officials, and the user makes something like Include Spanish_localisation. But, also, that would mean that multilanguage games should provide objects and messages in different languages for the same code. That’s quite hellish, so I think we should aim for one language per source code game.

Anyway, this is a great start. I will have the localization ready VERY SOON. Thanks!

2 Likes

That would be great, thank you!

1 Like

Ok, this is just a convenience so other people localizing the messages has not have to copy and paste localize again and again.

Of course, people could use this to customize their own system messages.

I don’t know where to store this to be useful, so let’s paste it here:

localise talking_to	Talking to:
localise ask_about	Ask about:
localise tell_about	Tell about:
localise say	Say:
localise its_dark	It's dark.
localise you_can_also_see	{You} can also see:
localise you_can_also_see_scroller	{You} can also see
localise youre_holding	{Youre} holding:
localise youre_carrying	{Youre} carrying:
localise youre_wearing	{Youre} wearing:
localise taken	Taken.
localise you_cant_carry_any_more {You} can't carry any more.
localise dropped	Dropped.
localise exits	Exits:
localise actions	Actions:
localise you_cant_see	{You} can't see!
localise its_too_dark_to_see_clearly	It's too dark to see clearly.
localise you_see_nothing_special_about_that	{You} see nothing special about {the $this}.
localise ok_youre_wearing_it	OK, {youre} wearing {obj $this}.
localise ok_youve_taken_it_off	OK, {youve} taken {obj $this} off.
localise time_passes	Time passes...
localise you_start_talking_to	{You} start talking to {the $this}.
localise you_stop_talking_to	{You} stop talking to {the $this}.
localise you_are_dead	{You_are} dead
localise and	and # (when listing room contents in scroller)
localise or	or # (not currently used)
localise save_button	save game
localise restore_button	restore game
localise restart_button	restart game
localise undo	undo
localise cant_undo	Can't undo, sorry
localise undone	Undone "{$this}"
localise restart_prompt	Really restart this game?
localise restart_confirm	Restart
localise restart_cancel	Continue
localise save_prompt	Save game as:
localise save_confirm	Save
localise save_cancel	Cancel
localise options	options
localise credits	credits
localise font	font
localise font_size	font_size
localise print_room_title_in_scroller	Print room title in scroller:
localise list_objects_in_scroller	List objects in scroller:
localise options_title	Display options
localise options_always	Always
localise options_landscape_only	Landscape only
localise options_never	Never
localise options_done	done
2 Likes

Ok, I have now the game mostly speaking in spanish:

The only thing, for now, I don’t know how to translate yet (I’ve made this in a hurry) are the instructions, and the wait command, because this last thing is not working:

verb wait
display esperar
continue

Also, all the messages about options, saving the game and restoring and such,including all the options panel, are not working.

But, this is really neat! Thanks!

2 Likes

thinking about this with my pillow… this would need also a way for the author to program their own game messages on a table.

As you know, this is exactly how most adventures were programmed in the 80s, so it is very convenient.

You need to provide a way for the author to define new messages and call them later. I mean, in addition to

Say You have acquired the megaton.

the author should use something like

say_mesg taken_megaton

So, for defining a new message in a new game end you end with:

def_mesg taken_megaton You have acquired the Megaton.
localise german taken_megaton Sie haben die Megatonne erworben.
localise french taken_megaton Vous avez acquis la mégatonne.

And with that, you open the door to games with multiples languages in Gruescript!!! WHAAAAAT!

oh, I have something more to report:

When downloading the spanish game, the special characters are messed up.

We found that the produced HTML file has missing the follwoing code:

<meta charset="utf-8"/>

Maybe, later, there should be a char set code selector from the options of Gruescript editor.

Thanks.

2 Likes