New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization trans() namespace is not working on above-root installation #805

Closed
lesaff opened this Issue Jul 10, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@lesaff

lesaff commented Jul 10, 2016

Steps to reproduce

  1. Run a v2 site with above-root installation
  2. Run an addon that uses $this->trans()

Expected behaviour

Text/string should be displayed per addons/<addon_name>/resources/lang/en/filename.php

Actual behaviour

trans('filename.some_key') returns as is addons.<addon_name>::filename.some_key

Note

This issue does not replicate on a standard install (not above-root)

Server configuration

Operating system: Ubuntu Trusty 64 (14.04 TLS)

Web server: Apache 2.4x

PHP version: 7.0.8

Statamic version: 2.0.11

Updated from an older Statamic or fresh install: Updated

@warkior

This comment has been minimized.

warkior commented Oct 12, 2016

I've experienced this issue as well. A quick and dirty fix was to just add the following line to statamic/core/Providers/AddonServiceProvider.php on line 116, just before the end…

$path = '../' . $path;  // This is the new line that makes addon translations work for me...
$this->loadTranslationsFrom($path, $namespace);

This fix will likely be overwritten the next time we upgrade the platform. Perhaps future versions could detect the proper location of the addons folder and use that as part of the $path variable.

@jasonvarga jasonvarga closed this Jun 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment