PHPackages                             bushbaby/bsb-localized-template-path-stack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. bushbaby/bsb-localized-template-path-stack

ActiveLibrary[Templating &amp; Views](/categories/templating)

bushbaby/bsb-localized-template-path-stack
==========================================

BsbLocalizedTemplatePathStack is a small ZF2 module that provides a template stack resolver which resolves to templates based on the current locale.

1.0.1(12y ago)1512MITPHPPHP &gt;=5.3.3

Since Oct 13Pushed 12y ago2 watchersCompare

[ Source](https://github.com/bushbaby/BsbLocalizedTemplatePathStack)[ Packagist](https://packagist.org/packages/bushbaby/bsb-localized-template-path-stack)[ Docs](https://github.com/bushbaby/BsbLocalizedTemplatePathStack)[ RSS](/packages/bushbaby-bsb-localized-template-path-stack/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

BsbLocalizedTemplatePathStack
=============================

[](#bsblocalizedtemplatepathstack)

BsbLocalizedTemplatePathStackResolver is a small ZF2 module that provides a template path stack resolver to load templates named to the active locale.

Installation
------------

[](#installation)

### as zf2 project

[](#as-zf2-project)

BsbLocalizedTemplatePathStackResolver works with Composer. To install it into your project, just add the following line into your composer.json file:

```
"require": {
    "bushbaby/bsb-localized-template-path-stack-resolver": "*"
}

```

Then update your project by runnning composer.phar update.

Finally enable the module by adding BsbLocalizedTemplatePathStackResolver in your application.config.php file.

### as standalone

[](#as-standalone)

For development purposes you might want to install BsbLocalizedTemplatePathStackResolver standalone. Clone the project somewhere on your computer

```
git clone git@github.com:bushbaby/BsbLocalizedTemplatePathStack.git BsbLocalizedTemplatePathStack
cd BsbLocalizedTemplatePathStack
curl -sS https://getcomposer.org/installer | php
git checkout develop
./composer.phar install
phpunit

```

Configuration
-------------

[](#configuration)

To configure the module just copy the bsb\_localized\_template\_path\_stack.local.php.dist (you can find this file in the config folder of BsbLocalizedTemplatePathStack) into your config/autoload folder, and override what you want.

Note that the resolver is attached after the zend resolvers. This means that it will be only visited when those fail to resolve to a template.

The the resolver is automaticly configured with the paths supplied in the view\_manager\['template\_path\_stack'\] option and it are these paths that are used to look for a localized version of a template.

### Options

[](#options)

**fallback\_locale** string, defaults to null

The resolver will use this locale as fallback locale when primary locale will not resolve.

Note: When the value is not a string, the factory will get the application translator and use its fallback locale. The second value in the translator locale option represents the fallback locale within the application translator.

```
'translator' => array(
    'locale' => array(null, 'en_GB')
)

```

**name\_conversion\_pattern** string, defaults to '#DIRNAME#/#FILENAME#/#LOCALE#.#EXTENSION#'

This pattern is used to look for a template.

### Example

[](#example)

Given a directory structure and a template name of 'application/index' the default pattern will be able to succesfully resolve a template if the current locale is one of nl\_NL, de\_DE or en\_UK.

```
view
  application
	index
      index
        nl_NL.phtml
        de_DE.phtml
        en_UK.phtml

```

Given a directory structure and a template name of 'application/index' the conversion pattern should be changed to '#DIRNAME#/#LOCALE#/#FILENAME#.#EXTENSION#'.

```
view
  application
	index
      nl_NL
        index.phtml
      de_DE
        index.phtml
      en_UK
        index.phtml

```

This will resolve to application/index/nl\_NL.phtml when the current locale is nl\_NL. When the current locale is en\_US resolving will fail unless a fallback locale has been set (to one of the provided templates).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~44 days

Total

2

Last Release

4547d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e42bb1eb4035d280d16210974fa60d0dbddeba8a061abec926e5e081d097231d?d=identicon)[bushbaby](/maintainers/bushbaby)

---

Top Contributors

[![basz](https://avatars.githubusercontent.com/u/143068?v=4)](https://github.com/basz "basz (6 commits)")

---

Tags

i18ntemplatemodulezf2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bushbaby-bsb-localized-template-path-stack/health.svg)

```
[![Health](https://phpackages.com/badges/bushbaby-bsb-localized-template-path-stack/health.svg)](https://phpackages.com/packages/bushbaby-bsb-localized-template-path-stack)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
