Giter Club home page Giter Club logo

alan-i18n's Introduction

Travis CI Status  Alan version  Ruby version  License

ALAN Internationalization Project

Multi-language translations of the ALAN Foundation Library, a basic ALAN Interactive Fiction library to begin creating text adventures in different languages, and provide reference implementations to add support for new locales.

Created by Tristano Ajmone on April, 2021.

IMPORTANT — All ALAN sources, solutions and transcripts files in this project are UTF-8 encoded. You'll need ALAN version 3.0Beta8 (or above) in order to use this project and its libraries.


Table of Contents


Project Contents

Library Locales

folder locale description date
/alan_en/ English Reference implementation. Nov. 2007
/alan_es/ Spanish By M.Donantuonni & B.Humphrey. Apr. 2010
/alan_it/ Italian By Tristano Ajmone Nov. 2021

For more info on the status of the various libraries, see the PORTS_STATUS.md document.

About

The goal of the Alan-i18n repository is to gather under a single project multilingual implementations of a basic ALAN library to start developing adventures with.

In computing jargon, a spoken language is referred to as a locale, to avoid confusion with programming languages, and the term "i18n" stands for internationalization and localization, i.e. adapting computer software to different languages.

These libraries can be used to start creating text adventures in different locales, or serve as reference implementation for anyone wishing to create a library to support a new locale.

The reference implementation is the English Foundation Library, based on the ALAN Library v0.6.2, which was created by the Alan IF community over the years, and across various Alan incarnations, up to November 2007, after which it was replaced by newer and more sophisticated libraries (Library v1, and the Standard Library v2).

For the goals of this project, the older library v0.6.x provided a better reference implementation for those wishing to translate and adapt it to a new locale, because of its highly modular structure where each file handles a specific feature, so we decided to take on its development from where it stopped, gradually update it make use of the new ALAN features that were introduced since 2007, and rename it to avoid confusion with the original library.

The Foundation Library is also a good starting point for those who wish to write a highly customized adventure, where the adventure world (its object types, verbs and commands) is tailored to the story needs, because the library strikes a good balance between simplicity and features coverage. Most features can be tweaked, removed or expanded by acting on the single library module (file) that implements a specific feature, whereas more sophisticated libraries usually come at the price of a more entangled system, where features are interconnected with each other in complex ways.

In any case, as their name suggests, these libraries implementations are intended as starting points to begin working with ALAN IF, in general.

Unlike most other IF authoring systems, ALAN doesn't ship with a default library, and the language doesn't predefine world objects, player commands nor directions; it instead provides authors with the right tools to easily define them according to need. By design, ALAN is a locale agnostic IF system — i.e. it doesn't assume any target language as being the default one.

The ALAN philosophy is entirely devoted to freedom — not only because it's a free and open source system, but because it provides IF authors with utter freedom when it comes to designing their own adventure worlds, allowing their creation from the ground up, according to the needs of each adventure and the author's personal taste.

Build Instructions

This project uses Rake (Ruby's Make) to handle task management and build automation. Being a dependency based system, Rake allows quick project updates since it will only rebuild those assets that need to be (if any).

A nice feature of Rake is that it might be invoked from any folder within the repository directory, so you don't need to issue the rake command from the root folder — as long as you're inside the repository tree the command will work as if typed at the root.

To build outdated assets in the project:

$ rake

To forcefully rebuild the whole project:

$ rake -B

To do a dry run without executing actions:

$ rake -n

To delete all generated files from the project:

$ rake clobber

To view all available build tasks:

$ rake -T

To view all tasks and their dependencies:

$ rake -P

System Requirements

In order to fully build this project you'll need the following tools:

Alan SDK

You'll need the latest Beta version of the command line Alan SDK (Software Development Kit), and make sure that both the Alan compiler and the ARun interpreter binaries are reachable through the system PATH.

NOTE — We're working on an alternative solution that will delegate to Rake the task of downloading and updating the required SDK binaries (according to OS) and add them to a dedicated repository folder (ignore by Git) in order to make this project independent from any global SDK setup. In the meantime, you'll need to setup the SDK binaries manually.

Ruby

You'll need Ruby version 3.

Windows users should use RubyInstaller, which can also be installed as a Chocolatey Ruby package using the Chocolatey GUI package manager, which simplifies keeping it always up to date.

Rake

Some Ruby versions natively ship with Rake (e.g. Ruby for Windows), if not just install it via:

$ gem install rake

License

The Alan Library was originally part of the Alan repository and its therefore governed by the same Artistic License 2.0. All translations of the original English Alan Library are derivative works, and therefore fall under the same license terms.

Any third party sample adventure in this repository is governed by its own license, as specified in the README and/or license file inside its folder.

Every other asset in this repository is to be assumed as being licensed under the Artistic License 2.0, unless otherwise specified.

More details about the license terms, authors and credits of each third party asset can be found in its README file.

Useful Links

alan-i18n's People

Contributors

rich15 avatar tajmone avatar thoni56 avatar

Watchers

 avatar  avatar  avatar

Forkers

rich15

alan-i18n's Issues

Spanish Lib 0.3.3 Tasks List

This Issue tracks the changes for the upcoming Spanish Foundation v0.3.3, built around PR #45 by @Rich15.

The task-list below will be updated and expanded as the work progresses. For features and topics being discussed elsewhere, reference links are provided to their respective Discussion threads.

This Issue thread will host generic comments and discussion on the overall progress of the actual implementation work, but general considerations on the various features and changes, as affecting the overall Foundation project, or deciding what to include, should be dealt-with in dedicated Discussion threads, to avoid cluttering this Issue, where we track decided-upon tasks.

  • gramática.i:
    • Predefined Player Words — Add missing SYNONYMS for:
      • AND WORDSY and LUEGO.
      • BUT WORDSexcepto
      • THEM WORDSpostponed! (see #51)
    • Proper Named Entities — entities with proper name have empty-string articles:
      • Add new nombre_propio attribute (defaults to Has not).
      • Tweak initialization code for entities with nombre_propio so they have empty-string articles (both Definite/Indefinite).
    • Move plural pronouns from SYNONYMS of 'IT' to a separate definition matchin 'THEM' instead (see #51).
  • mensajes.i — polish and revise the translation of some Run-Time MESSAGEs (notes found in the source file):
    • CONTAINMENT_LOOP2
    • NO_UNDO
    • UNKNOWN_WORD
  • META VERBS:
    • meta_sesión.i:
      • Add transcript verb?
      • SYNONYMS for UNDO? (see #47) — not possible! it won't work, because UNDO is not part of the game dictionary, it's a special command intercepted by the parser.
  • tests/meta.alan — Implement all requied tests for META VERBs, Run-Time MESSAGEs and other "meta" stuff like predefined player words, etc.:
    • @Rich15: Translate English & check Spanish in ALAN source.
    • solution files:
      • meta-badcode.a3s
      • meta-descriptions.a3s
      • meta-input-errors.a3s
      • meta-player-words.a3s
      • meta-session.a3s
    • @tajmone: Examine carefully all meta-*.a3t transcripts for possible test improvements, formatting, etc..
      • @Rich15: Once all the above meta tests are completed, could read all the transcripts again and check this box when no problems are found.
  • PRE-MERGE TASKS — Once all of the above are deal with:
    • Update Lib Version & Date to v0.3.3 (2021/11/22):
      • alan_es/README.md → version badge.
      • alan_es/Foundation/CHANGELOG.md → release entry.
      • alan_es/Foundation/Library.i → header comments.
      • alan_es/vampiro/vampiro.alan → header comments.
      • Run Rake and commit changes.

NOTE — This next version might require more work than it might seem at first, because test coverage of meta verbs and run-time messages can be quite tricky to achieve, and as these tests are implemented they often reveal overlooked translation and GNA problems.

Furthermore, some meta-feature inherited from ALAN Lib v0.6 are worth discussing, since for the Foundation Library project (not just the Spanish library) we might improve or revise their design. Since we'll be looking closely into META VERBs, this might be a good time to evaluate and discuss them.

Lib EN: 'brief' and 'verbose' not Meta Verbs

  • Make brief and verbose META verbs:
    • English Library.
    • Spanish Library.

I've noticed that in the English Library the commands brief and verbose (defined in brief.i module) are not defined as meta verbs:

Syntax
  verbose = verbose.

Verb verbose
  Does
    Visits 0.
    "Verbose mode is now on."
End verb.


Syntax
  brief = brief.

Verb brief
  Does
    Visits 1000.
    "Brief mode is now on. Location descriptions will only be shown
     the first time you visit."
End verb.

It would probably make sense to make these two commands meta verbs, since they are out-of-world actions dealing with the game play, not the story.

HELP — Spanish Speaker Needed!

We need the help of a native (or fluent) Spanish/Castilian speak for the update work of the Spanish Foundation Library.

Ideally, we're looking for someone who's willing to take on maintenance of the Spanish Library — i.e. working both on its code and text — but having someone who can help us out with the text work would be already a great start — i.e. proofreading changes to the library messages, helping with translation work from English, etc.

Our goal is to update the Spanish Library to meet the new changes in design and feature which we're applying to the English Foundation Library, so that both libraries will mirror each other when they reach v1.0.0, and are kept en par henceforth.

Currently, updates to the Spanish library are being handled by Tristano Ajmone — i.e. me — who is Italian and can more or less understand Spanish (having lived in Spain for a while), but he can't write Spanish, which is his main obstacle when it comes to changes that will affect text output.

So, if you're an IF enthusiast who's willing to help us with the Spanish library, please reply to this post. If you have no experience with ALAN, don't worry, we'll be working together as a team, so we can work together on the code aspects. Also, programming ALAN is very easy to learn and it won't take long either.

Fix Travis Badge Link

The Travis CI badge links to the Travis page of the alan repo, instead of the page of alan-i18n!

Amend the references-style link in README.md

Wrapping Bug for Spanish GNA

@thoni56, I've noticed an issue with how ALAN wraps transcripts.

Example, in ponibles_test.a3t the 's' of "puestos" is split on the next line:

> x gemelos
Unos gemelos. Ambos llevan la misma ropa puesta. Los gemelos llevan puesto
s unos pantalones y unas botas.

This is the library code that prints "puestos":

  "llevas puest$$"
  If obj is femenina
    then "a"
    else "o"
  End If.
  If obj is plural then "$$s" End If.

The above is a typical example of how the Spanish library handles gender and noun in various language constructs (adjectives, articles, verbs, etc.), by adding the 'a' or 'o' suffix depending on gender, and a final 's' if plural.

The problem seems to be that when the sentence reaches "puesto" (column 75) ALAN decides it's time to wrap without checking whether the upcoming text contains a $$ (or punctuation) which might need to be joined with the current word (i.e. the one being parsed when ALAN decides to wrap).

If I were to replace the above code with:

  "llevas puest$$"
  If obj is femenina
    then
      If obj is plural
        then "as"
        else "a"
      End If.
    else
      If obj is plural
        then "os"
        else "o"
      End If.
  End If.
  If obj is plural then "$$s" End If.

the output wouldn't be truncated prematurely. Apparently, ALAN sees the $$ and waits before wrapping. The problem is that the above code variations is more verbose compared the to one being uses, because we only add the final 's' if the noun is plural (so no $$ on the previous vowel, in case there's not need to add a plurality 's').

Probably I should add a proper minimum viable ad hoc test in the alan-bugs-testbed, but I wanted to mention it right away when I discovered it, and begin by posting here on ALAN i18n, since this affects the Spanish library and we all need to be aware of the issue and decide if it's worth using the longer code to prevent breaking the word.

Also, I'm not sure why ALAN is wrapping at 75, since I believe the default is 80 columns. I think this issue of incorrect wrapping already came up before, and was due to miscounting the various special $ symbols in a way that affected columns book-keeping for when to wrap. But I thought that the problem had been solved already.

In any case, this problem also affects punctuation, for I noticed in various transcripts that ALAN wraps lines just before a ., , or ) (or other punctuation marks), which doesn't look nice either. I'm not sure if this is due to the presence of a $$ in the previous token or preceding the punctuation mark, but definitely ALAN should do some lookahead scrutiny before wrapping, to check that the next string "token" is not something that needs to be adjoined with the current one.

From what I remember from peeking at the ALAN sources, the way output strings work in ALAN is a bit intricate, since some strings are retrieved from disk (those that are within quotes in the source) while others are taken from memory (those stored as attributes), and that the way these are handles is a bit complex due to Huffman compression — so the whole process is a very fragmented series of long jumps in C, where the various snippets that will form a string a retrieved as the AMachine munches code in real time.

I'm not sure where the part that handles wrapping falls in the process, but it looks like strings are truncated as they are being "stitched together", i.e. there's no "paragraphs buffer" where they are stored for later inspection-&-wrapping. I guess that probably adding some lookahead functionality to prevent cases like the above would require lot's of code changes.

Spanish BUG: Syntaxes with "de" Not Working!

@thoni56 and @Rich15, I've come across a problem with compound prepositions in Spanish verbs. E.g. the SYNTAX for "put (obj1) on (obj2)" has two variations:

SYNTAX
  poner_sobre = poner (obj1) sobre (obj2).
  poner_sobre = poner (obj1) sobre de (obj2).

one with and another without "de". The same applies for many other prepositions of the type "on top of", "behind", "under", "near", etc.

The problem is that when the player tries to use the variation with "de" the parser fails to recognize the command replying that "there is no de obj2". E.g.

> poner el cuchillo sobre de fregadero
No hay de fregadero aquí.

whereas using the version without "de" works fine:

> poner el cuchillo sobre fregadero
¡Naaah!. Prefiero poner el cuchillo en el suelo.

I've tried swapping place between the two syntaxes (so the longer one would become the default), or enclosing within quotes 'sobre de', or individually 'sobre' 'de', but to no avail.

The problem seems that ALAN doesn't expect more than one word (token) between parameters, and if it finds one it considers it to be part of the parameter name (i.e. as if it was an adjective + name).

So far, the only solution that comes to my mind would be to add a name variant containing "de" for each object that is a candidate for such verbs, e.g.

The fregadero IsA object at xxxx
  Name fregadero.
  Name de fregadero.

I haven't tried that yet (will do), but it seems a rather ugly workaround and a desperate attempt to save the situation, rather than a real solution. Even if it worked, it should be done on every object instance (or even actors) since the player might attempt such VERBs that contain a "de" on any object really, not just does that we want to be usable with such verbs!

@thoni56, any thoughts on this? why it's happening, and if there are possible solutions?

@Rich15, how bad is it in the Spanish language to omit the "de" in such commands? Is it something that players can cope with, or does it feel totally unnatural?

I noticed that all these type of verbs contain the SYNTAX variant without "de" (as the default), but now I'm not sure whether this was done because of the above problem, or because both forms are acceptable (at least in terms of IF playing, where less typing is more).

If there's no way to make the SYNTAX variants with "de" working, we should just delete them.

References

Adopt New Official Extensions for ALAN3 Solution and Transcript Files

Switch to the upcoming official extensions .a3s and .a3t for ALAN3 solution files and transcripts, respectively (see alan-if/alan#2):

  • Change file extension of all:
    • Solution files: .a3sol.a3s
    • Transcripts: .a3log.a3t
  • Update all repo files accordingly:
    • Documentation (.md).
    • Git and EditorConfig settings files.
    • Scripts:
      • Bash .sh
      • Batch .bat
      • SED scripts?
  • Update Wiki accordingly (if needed).

Dubious Code in 'take.i'

Module take.i contains a dubious piece of code, which we might want to fix, also in out ports to Swedish and Italian:

Syntax
  take_from = 'take' (obj) 'from' (holder)
    Where [...]

Add to every object
  Verb take_from
    When obj
      Check obj not in hero  -- <1>
        else "You already have" say the obj. "."
      And obj in holder      -- <2>
        else Say the obj. "is not there."
      Does
        If holder=hero then  -- <3>
          "You don't need to take things from yourself!"
        else
          Locate obj in hero.
          "You take" say the obj. "."
        End if.
  End verb.
End add.

How can the following code ever execute:

      Does
        If holder=hero then  -- <3>
          "You don't need to take things from yourself!"

if checks <1> and <2> passed? i.e.:

  1. The obj is not in Hero.
  2. The obj is in holder.

The hero can't possibly be the holder of obj at point <3>!

Or am I missing out something here (because it's late night and I'm half asleep)?

From my experience with libraries, it makes more sense to put absurd/nonsensical command on top of the CHECKs lists, so I'd change that to:

    When obj
      Check holder <> hero
       esle "You don't need to take things from yourself!"
      And obj not in hero
        else "You already have" say the obj. "."
      And obj in holder
        else Say the obj. "is not there."

Untranslated Spanish Messages

There are still some messages that were not translated to English in the original pALANte library:

  • empujar.i (= push.i):
    • Verb empujar_con (= 'push obj1 with obj2'):
      • "You can't empujar that."
        (when obj1 is not a thing)
      • "You can use only objects to empujar things with."
        (when obj2 is not an object)

Spanish Foundation v0.4.0

Pending tasks for upcoming Spanish Foundation v0.4.0:

  • Library code:
    • Find new replacement name for scenario class.
  • Vampiro:
    • Replace all examinar VERBs on Escenario with an xDesc attribute, when possible (i.e. when no other code is involved).
  • Fix Library version in:
    • Library.i
    • alan_es/README.md badge.
  • When release is ready:
    • Fix release date (now 2021/12/xx) in:
      • CHANGELOG.md
      • Library.i
    • Update ES CHANGELOG.md
    • Fix PORT_STATUS.md doc, adding v0.4.0 as version fulling the "Honour xDesc in scenery" row.

Help with Swedish MESSAGEs Template

@thoni56, in the resources/ folder I've added templates for the runtime MESSAGEs, which might help users who want to port the Starter Library to a new language:

Could you please check that the Swedish template is correct and translate the various comments, which I left in English?

The comments are mostly section titles, since I've grouped the various MESSAGEs by category, but there's also a brief introductory text and a couple of notes with some tips.

Thanks.

Consolidating README and historical information

I started the Swedish library by copying the English. This gives a good starting point, but also a lot of duplicated documentation.

So, currently both the English and Swedish contain a lot of background info about the history, ancestry and recovery of this library (which was in English only).

That information seems like it should be consilidated on the top level.

The language-level Readme should probably focus on information on that library itself, possibly referring to the top-level README.

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.