Comments (12)
@phh Makes sense. Alright, I will work on your PR to make it work.
from laravel-translatable-string-exporter.
from laravel-translatable-string-exporter.
I suggest us making the translation folder path configurable instead of supporting multiple folders.
from laravel-translatable-string-exporter.
But since Laravel mainly has these to formats, why not make sure both works of out the box, and then support edge cases by config if you decide to move your language folder to another location.
from laravel-translatable-string-exporter.
Well, investigating the bug can take time but our users can't wait. I will now move the translation path to the config. We can improve it later.
from laravel-translatable-string-exporter.
I don't like the approach which is used in Laravel core to get the language path https://github.com/laravel/framework/blob/4c7cd8c4e95d161c0c6ada6efa0a5af4d0d487c9/src/Illuminate/Foundation/Application.php#L324 but I've implemented the same for now just to match.
No new config parameters.
from laravel-translatable-string-exporter.
@phh When you have time, could you please test the master
branch?
from laravel-translatable-string-exporter.
Yes! Seems to work. I've only tested with Laravel 9 but following works for me:
/lang
and/resources/lang
both exists -resources/lang
is getting picked (maybe choose/lang
as default in V2)/lang
exists works/resources/lang
works- Not having a lang folder will just output an error:
file_put_contents(/var/www/html/lang/<lang>.json): Failed to open stream: No such file or directory
from laravel-translatable-string-exporter.
I think src/Core/Utils/Misc.php can be removed
from laravel-translatable-string-exporter.
@kkomelin Why not go all in and just use the lang_path()
or alternative the resource_path()
?
/**
* Get language file path.
*
* @param string $base_path
* @param string $language
* @return string
*/
public static function languageFilePath($base_path, $language)
{
return function_exists('lang_path') ? lang_path("$language.json") : resource_path("lang/$language.json");
}
from laravel-translatable-string-exporter.
Thank you @phh for your tests and the detailed feedback. I will answer your questions one by one.
maybe choose /lang as default in V2
Yes, I'm thinking of not supporting anything below Laravel 9 in 2.0.0, so everything can be simplified in there.
I think src/Core/Utils/Misc.php can be removed
Yes, thanks. I just forgot to delete it. Now it's done here 55a5ca6
@kkomelin Why not go all in and just use the lang_path() or alternative the resource_path()?
- As you pointed out in one of your PRs, the
lang_path()
function was added in L8 and we have to support previous versions as well. - To not overcomplicate and overoptimize things which already work fine.
- Laravel core doesn't yet use lang_path() and I don't actually like this fact https://github.com/laravel/framework/blob/4c7cd8c4e95d161c0c6ada6efa0a5af4d0d487c9/src/Illuminate/Foundation/Application.php#L324
But I've added a deprecation notice for 2.0.0 87c330b
from laravel-translatable-string-exporter.
The release is here https://github.com/kkomelin/laravel-translatable-string-exporter/releases/tag/1.15.1
Thanks for your help.
from laravel-translatable-string-exporter.
Related Issues (20)
- Strings with quotes get truncated or escaped again HOT 3
- Strings containing round brackets are truncated improperly HOT 1
- Make it possible to exclude some folders from the search HOT 12
- It cannot handle `__('Search...')`
- Exclude short translation keys from export HOT 6
- JSON File HOT 1
- Parsing Issues still persist HOT 5
- Ability to add comments that provide enhanced features HOT 3
- Undetected strings if "key"-argument starts on new line HOT 4
- Drop support for PHP 5.6 in 1.16.0 HOT 4
- Release 1.16.0 HOT 2
- require-dev instead of require ? HOT 5
- Split short-keyed translations into separate directories/files? HOT 1
- Drop support for PHP 7.4 and Laravel 5.x/6.x/7.x
- Enable `exclude-translation-keys` by default
- [feature-request] per function transformation HOT 5
- Changing export directory HOT 1
- excluded-directories does not work as expected HOT 3
- Not adding new string on inspect-translations HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-translatable-string-exporter.