Comments (10)
@themsaid i think you should close this issue now :D.
from laravel-langman.
@ahmedash95 Question :
I have translations for enums. Here is some code :
Enum declaration in config/enums.php
return [ 'gender' => [ 'MALE', 'FEMALE', ] ];
Translations in resources/lang/en/enums.php
return [ 'gender' => [
'MALE' => 'Man',
'FEMALE' => 'Woman',
] ];
Views can use it from a model for example:
{{ trans('enums.gender.' . $person->gender); }}
What happens in that case when you sync translations? What is the content of enums.php
after the sync process?
from laravel-langman.
@vpratfr config/enums.php out of sync scope becase it just an array doesn't use any lang methods! . or I misunderstand ?
from laravel-langman.
{{ trans('enums.gender.' . $person->gender); }}
The above method call will be ignored by the sync command as it contains a dynamic key, only specific key calls are considered. If you have an idea on how to support this type of calls I'll be glad to consider it.
from laravel-langman.
There is no real way to support it. However, good to know it is ignored, I think that is the best way to handle it.
How about the existing translation messages in resources/lang/en/enums.php
? Will they get erased?
It would be handy (and maybe safe) to be able to specify a list of files to ignore in the lang folders when sync-ing.
from laravel-langman.
Actually I think we are mixing two different things:
- Process of finding/removing translation keys from the code (views, classes) and updating the translation files with that (potentially only touching the default language files, not translations).
- Process of simply synchronizing translation files accross languages (I have a set of files for default language
en
(could be another default lang) which is supposed to be complete, and now I want to add/remove missing keys from other language files)
Both of them are doing something different. And I don't really know what your package does. Maybe it would be a good idea to have a command for each?
from laravel-langman.
Nope, it won't get erased, it'll stay untouched.
Regarding ignoring files, why would you want to ignore a file? I don't mind having an option --ignore=enums,users,auth
but curious about the use cases.
Regarding your other opened issue, is it still not working? Did you succeed figuring out what was wrong?
from laravel-langman.
Ignoring a file is in case a translation is not in code anymore and you remove them from language files.
If you don't do any removal of unused translation keys, then ignoring is not really necessary.
from laravel-langman.
I'm not sure I quite understand the use case, do you mean if you remove the trans()
calls for specific keys from code and you want to keep the language file although it's useless?
from laravel-langman.
v1.2.2 now looks inside the app directory in addition to the views directory.
from laravel-langman.
Related Issues (20)
- ๐Calling for help HOT 4
- Langman not compitable with laravel 8, HOT 5
- php 8 support HOT 1
- How we can use it in a project multilang Ar En? HOT 1
- Lang files are not PSR-2 HOT 3
- Disable URL on production HOT 2
- langman:sync autocreate
- Create lang file dynamically
- Utf8 Character Translation Not Working
- key with ' in it, breaks it
- Ignore files
- key with '.' in it, creates nested key
- Empty array on lang file throws offset error when syncing HOT 2
- Scan Error - Cannot read property 'Login' of undefined
- Specify language for missing
- Arabic (ar) support
- Lang files in sub-directories of the app not handled (non-vendor) HOT 1
- Laravel 6 compatibility HOT 4
- Cyrillic symbols is not working in not saving,
- Please fix with php 7.4 HOT 5
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-langman.