Giter VIP home page Giter VIP logo

Comments (12)

kkomelin avatar kkomelin commented on May 31, 2024 1

@phh Makes sense. Alright, I will work on your PR to make it work.

from laravel-translatable-string-exporter.

phh avatar phh commented on May 31, 2024

#61

from laravel-translatable-string-exporter.

kkomelin avatar kkomelin commented on May 31, 2024

I suggest us making the translation folder path configurable instead of supporting multiple folders.

from laravel-translatable-string-exporter.

phh avatar phh commented on May 31, 2024

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.

kkomelin avatar kkomelin commented on May 31, 2024

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.

kkomelin avatar kkomelin commented on May 31, 2024

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.

kkomelin avatar kkomelin commented on May 31, 2024

@phh When you have time, could you please test the master branch?

from laravel-translatable-string-exporter.

phh avatar phh commented on May 31, 2024

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.

phh avatar phh commented on May 31, 2024

I think src/Core/Utils/Misc.php can be removed

from laravel-translatable-string-exporter.

phh avatar phh commented on May 31, 2024

@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.

kkomelin avatar kkomelin commented on May 31, 2024

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()?

  1. 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.
  2. To not overcomplicate and overoptimize things which already work fine.
  3. 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.

kkomelin avatar kkomelin commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.