Giter VIP home page Giter VIP logo

sculpin_multilingual's Introduction

Sculpin Multilingual Bundle

Description

This extension was created to handle a Sculpin multi-lingual site where each language occupies a separate subdomain.

Out of the box Sculpin can already provide this with a directory within the source directory for each language subdomain.

For example a spanish/english site running on es.example.com and en.example.com could use:

> tree source
source
├── en
│   ├── about.html
│   └── contact.html
└── es
    ├── contacto.html
    └── sobre.html 
    
> sculpin generate
    
> tree output_dev
    
output_dev
├── en
│   ├── about.html
│   └── contact.html
└── es
    ├── contacto.html
    └── sobre.html    

This is fine to render the files for each language from a unique source for each subdomain, but if any files need to be shared across all subdomains (css/js/images) then either copy/paste or symlinks are required which can get messy across many subdomains.

This extension allows you to define a shared directory in the Sculpin source directory for shared assets and define which target directories the shared resource should populate.

The example again using the extension setup to share images, js and css:

> tree source
source
├── en
│   ├── about.html
│   └── contact.html
├── es
│   ├── contacto.html
│   └── sobre.html
└── shared
    ├── css
    │   └── site.css
    ├── img
    │   └── image.jpg
    └── js
        └── site.js
 
> sculpin generate        
        
> tree output_dev
output_dev
├── en
│   ├── about.html
│   ├── contact.html
│   ├── css
│   │   └── site.css
│   ├── img
│   │   └── image.jpg
│   └── js
│       └── site.js
└── es
    ├── contacto.html
    ├── css
    │   └── site.css
    ├── img
    │   └── image.jpg
    ├── js
    │   └── site.js
    └── sobre.html        

Installation

Edit your sculpin.json file:

{
    // ...
    "require": {
        // ...
        "rocketage/sculpin-multilingual-bundle": "@dev"
    }
}

and install by running sculpin update.

Now register the bundle in app/SculpinKernel.php:

class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel
{
    protected function getAdditionalSculpinBundles()
    {
        return array(
            'Rocketage\Sculpin\Bundle\MultilingualBundle\SculpinMultilingualBundle'
        );
    }
}

Configuration

Define the shared directory name and the target direcotries in the Sculpin app config app/config/sculpin_kernel.yml:

sculpin_multilingual:
  shared_directory: 'shared'
  target_directories:
    - en
    - es

sculpin_multilingual's People

Stargazers

Ulumuddin Cahyadi Yunus avatar Federico J. Álvarez Valero avatar Cees-Jan Kiewiet avatar James avatar Shinji Kaneko avatar

Watchers

James Cloos avatar Rick Peacock avatar Alexey Pyltsyn 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.