Giter Club home page Giter Club logo

hobo-i18n's Introduction

== Welcome to the EXPERIMENTAL Hobo-I18n Fork

This is just a (still Experimental) I18n fork of git://github.com/tablatom/hobo.git

== Main Features / Changes

There is now a translation tag (see: hobo/rapid/core.dryml) that uses the RoR 2.2 I18n translate method. I started to translate the dryml generators in dryml_generators/rapid and a few other methods.

== The Translate Tag <trans key="foo.bar">Fallback</trans>

The main idea of the translate tag: Replace the wrapped content with the translated string identified by the key. 

By using the content of the key as a default value its possible to leave the 
templates mostly as they are. Just wrap the strings that shall be translated with the <trans> tag.

If you don't provide a translation file/keys everything should keep as is.

If you provide the matching keys, the inner content will be replaced by the translated string.

=== The hobo scope (default) and the model attribute

All standard translations are scoped with hobo (see below). If you want specific translations for specific models, just copy/add another scope with the name of the model. For example you can have a specific heading for a "customer" index page by giving the following translation key:

customer.page.index.heading = "My special customer index heading"


=== Issues

- There are more conventions added by rails. Mainly the lazy lookup/automatic skin scoping http://guides.rubyonrails.org/i18n.html -> 4.1.4. This would lead to other scoping conventions. Maybe this should be considered later

- Automatic inflections are no real use. (Just stay with the english defaults in most cases ;)) or use specific translation keys.

- Could replace view-hints for most cases

- <def tag="t"> didn't work :( Maybe someone else can dig into this.

- No tests yet

- A lot of methods still to be worked through :-/


=== Usage Examples

 <trans key="books.foo.bar"/> 
   -> translate "books.foo.bar", :default=>:"hobo.foo.bar", :model=>(translate "activerecord.models.book", :default=>"books")
 
 <trans key="books.foo.bar">Fallback</trans> 
   -> translate "books.foo.bar", :default=>[:"hobo.foo.bar", "Fallback"], :model=>(translate "activerecord.models.book", :default=>"books")
     
== (Example) Translation Files  

####
#### Hobo Translation
####
en:
  hobo:
    page:
      index:
        title: "{{model}} Index"
        heading: "{{model}} Index"
      new:
        title: "New {{model}}"
        heading: "New {{model}}"
      show:
        title:  "{{model}}"
        heading: "{{model}}"
        add_form_heading: "Add {{model}}"
      edit:
        title: "Edit {{model}}"
        heading: "Edit {{model}}"
      index_for_owner:
        title: "{{model}}s for"
        heading:
          your: "Your {{model}}s"
          other: "{{model}}s"
        subheading: "For:"
      new_for_owner:
        title: "New {{model}} for"
        heading: "New {{model}}"
        subheading: "For:"  
          
    collection:
      count:
        one: "There is only one {{model}} at the moment"
        other: "There are already {{count}} {{model}}s"
      heading:
        your: "Your {{model}}s"
        other: "{{model}}s"
      add_form_heading: "Add {{model}}"
        
    action:
      new: "New"
      create: "Create"
      previous: "Previous"
      next:  "Next"
      add: "Add"
      more: "More"
      delete: "Delete {{model}}"
      save: "Save"
      cancel: "Cancel"
      back: "Back to"
      edit: "Edit {{model}}"
    
    message:
      create:
        success: "The {{model}} was created successfully"
        error: "Couldn't create the {{model}}.\n {{errors}}"
      update:
        no_attribute_error: "No update specified in params"
        success: "Changes to the {{model}} were saved"        
        error: "There was a problem with that change.\n{{errors}}"
      destroy:
        success: "The {{model}} was deleted"
      permission_denied: "Permission Denied"
      not_found: "The page you requested cannot be found."
            
    form:
      new:
        heading: "New {{model}}"
    
    or: "or"
    
###
###  This is how to define specific texts for other models (just c&p the above structure)
###
#  customer:
#    page:
#      index:
#        title: "My special {{model}} Index title"
#        heading: "For Premium {{model}}s "
  

=== German ===
    
####
#### Hobo translations
####      
de:      
  hobo:
    # hobos default action translation
    actions:
      new: "Neu"
      create: "Erstellen"
      previous: "Zurück"
      next:  "Vor"
      add: "Hinzufügen"
      more: "Mehr"
      delete: "{{model}} löschen"
      save: "Speichern"
      cancel: "Abbrechen"
      edit: "{{model}} bearbeiten"
      back: "Zurück zu "
      send: "Abschicken"
      remove: "Entfernen"
      
    # hobos default message translation  
    messages:
      create:
        success: "{{model}} wurde erstellt."
        error: "{{model}} konnte nicht erstellt werden.\n {{errors}}"
      update:
        no_attribute_error: "Es wurden keine Attribute für die Bearbeitung übergeben."
        success: "Die Änderungen wurden gespeichert."        
        error: "Es gab Fehler bei der Änderung:\n{{errors}}"
      destroy:
        success: "{{model}} wurde gelöscht."
      permission_denied: "Zugriff verweigert."
      not_found: "Die gewünschte Seite wurde nicht gefunden."
      no: "Kein {{model}} vorhanden."
      confirm: "Sind Sie sicher?"
      
    # hobos default collection translation
    collection:
      count:
        one: "Es gibt nur ein {{model}}"
        other: "{{count}} {{model}}s"
      heading:
        your: "Deine {{model}}"
        other: "Dein {{model}}"
      add_form_heading:
        recommendations: "{{model}} Hinzufügen"
      empty_message: "Keine {{model}} vorhanden"
    
    # hobos form translation
    forms:
      new:
        heading: "{{model}} Erstellen"
      error:
        heading: "Um fortzufahren korrigiere folgendes:"

    # hobo support
    support:
      or: "oder"
    
    # hobos default pages translations
    index:
      title: "{{model}} Übersicht"
      heading: "{{model}} Übersicht"
    new:
      title: "{{model}} erstellen"
      heading: "{{model}} erstellen"
    show:
      title:  "{{model}}"
      heading: "{{model}}"
      back_link: "Zurück"
      edit_link: "{{model}} bearbeiten"
      new_link: "{{model}} erstellen"
      add_form_heading: "{{model}} hinzufügen"
    edit:
      title: "{{model}} bearbeiten"
      heading: "{{model}} bearbeiten"
    index_for_owner:
      title: "{{model}}s für"
      heading:
        your: "Deine {{model}}s"
        other: "{{model}}s"
      subheading: "Für:"    
    new_for_owner:
      title: "Neues {{model}} für"
      heading: "Neues {{model}}"
      subheading: "Für:"
    news_posts:
      edit:
        delete:
          label: löschen
          heading: "Diesen Neuigkeiten-Beitrag löschen"

    forgot_password:
      title: "Passwort vergessen"
      heading: "Passwort vergessen?"
      text: "Gib hier die E-Mail Adresse ein, mit der du dich registriert hast. Wenn wir diese in unserer Datenbank finden, werden wir dir eine E-Mail senden, mit der du dir ein neues Passwort generieren kannst."
    forgot_password_sent:
      title: "Passwort vergessen - Email versendet"
      heading: "Passwort vergessen - Email versendet"
      text: "Wenn die E-Mail Adresse {{email}} in unserer Datenbank vorhanden ist, wird dir eine E-Mail mit weiteren Anweisungen zum Zurücksetzen deines Passworts zugesendet. Solltest du diese E-Mail nicht erhalten überprüfe bitte deinen Spam-Ordner."
    account_disabled:
      title: Account nicht verfügbar
      heading: Account nicht verfügbar
      text: Dieser Account ist derzeit nicht verfügbar.

hobo-i18n's People

Contributors

tslocke avatar drnic avatar al2o3cr avatar bronson avatar bryanlarsen avatar

Watchers

James Cloos avatar Pierre Alvan avatar

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.