5

マルチテナント対応の Symfony2 ソリューションを開発していますが、現在のデフォルトの翻訳ファイルには最初のテナントの会社名などへの参照が含まれているため、テナントごとに異なる翻訳ファイルを使用する方法があるかどうか疑問に思っていました。

私は Liip テーマ バンドル ( https://github.com/liip/LiipThemeBundle ) を使用して、テナントが私たちのコードベースを使用できるようにしています。独自の翻訳ファイル。

これについてはテーマ バンドルの git リポジトリで話がありましたが、何も実装されていないと思います ( https://github.com/liip/LiipThemeBundle/issues/12 )。理想的には、そのスレッドで提案されたディレクトリ構造に従いたいと思います。

root
  - app
    - Resources
      - themes
        - <theme name>
          - public
          - translations (this would be new)
          - views

これにより、テナントが自身で維持できる自己完結型の git サブモジュールであるテーマの実践を続けることができるようになります。

4

1 に答える 1

3

I ended up using the directory structure I outlined above, and had a console command which symlinked the translations override file in app/Resources/translations. This command ran during my deploy script, and I then created my own "trans" twig function which checked if an override file should be used.

Not the cleanest, but definitely works the way I wanted.

于 2013-04-15T14:55:22.857 に答える