Skip to content

Conversation

@rrpadilla
Copy link
Contributor

@rrpadilla rrpadilla commented Oct 5, 2021

Based on the PR #36044 the framework will look for the lang directory in both the "resources" directory and at the top level.

Adding a new helper function lang_path to get the current path to the language folder.

$langPath = lang_path(); // PROJECT_DIR/resources/lang or PROJECT_DIR/lang

$langPath = lang_path('es'); // PROJECT_DIR/resources/lang/es or PROJECT_DIR/lang/es

$langPath = lang_path('en'); // PROJECT_DIR/resources/lang/en or PROJECT_DIR/lang/en

Using a custom directory. Don't have to figure it out where is the lang directory.

// Set the language file directory.
app()->useLangPath(resource_path('language'));
$langPath = lang_path(); // PROJECT_DIR/resources/language

$langPath = lang_path('es'); // PROJECT_DIR/resources/language/es

$langPath = lang_path('en'); // PROJECT_DIR/resources/language/en

@rrpadilla rrpadilla changed the title [8.x] adding lang_path to helpers [8.x] Adding lang_path to helpers Oct 6, 2021
@rrpadilla rrpadilla changed the title [8.x] Adding lang_path to helpers [8.x] Adding lang_path helper function Oct 6, 2021
@rrpadilla rrpadilla changed the title [8.x] Adding lang_path helper function [8.x] Adding lang_path helper function Oct 6, 2021
@taylorotwell taylorotwell merged commit 8b2cdb1 into laravel:8.x Oct 6, 2021
victorvilella pushed a commit to cdsistemas/framework that referenced this pull request Oct 12, 2021
* adding lang_path to helpers

* Update helpers.php

* Update helpers.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants