Skip to content
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

Package translations throw an exception #63

Open
royvanv opened this issue Feb 13, 2025 · 0 comments
Open

Package translations throw an exception #63

royvanv opened this issue Feb 13, 2025 · 0 comments

Comments

@royvanv
Copy link

royvanv commented Feb 13, 2025

Referencing a translation key from a Laravel package throws an exception, because it can not write to a file name containing colons.

Localizing: nl
0/1 [>---------------------------]   0% Localizing...
   ErrorException 

  file_put_contents(C:\laravel\lang\nl\filament-panels::layout.php): Failed to open stream: No such file or directory

  at vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:204
    201▕      */
    202▕     public function put($path, $contents, $lock = false)
    203▕     {
  ➜ 204▕         return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    205▕     }
    206▕
    207▕     /**
    208▕      * Write the contents of a file, replacing it atomically if it already exists.

  1   vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:204

  2   vendor\amirami\localizator\src\Services\Writers\DefaultWriter.php:34
      Illuminate\Filesystem\Filesystem::put("C:\laravel\lang\nl\filament-panels::layout.php", "<?php

return [
    'direction' => '',
];
")

PS C:\laravel> php artisan localize nl
Localizing: nl
0/1 [>---------------------------]   0% Localizing...
   ErrorException 

  file_put_contents(C:\laravel\lang\nl\filament-impersonate::action.php): Failed to open stream: No such file or directory

  at vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:204
    201▕      */
    202▕     public function put($path, $contents, $lock = false)
    203▕     {
  ➜ 204▕         return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    205▕     }
    206▕
    207▕     /**
    208▕      * Write the contents of a file, replacing it atomically if it already exists.

  1   vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:204

  2   vendor\amirami\localizator\src\Services\Writers\DefaultWriter.php:34
      Illuminate\Filesystem\Filesystem::put("C:\laravel\lang\nl\filament-impersonate::action.php", "<?php

return [
    'label' => '',
];
")

I think it should either ignore these types of translations.

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

No branches or pull requests

1 participant