Comments (3)
@runthis Not at all. Thank you for suggesting ideas and good luck with your projects!
from laravel-translatable-string-exporter.
Thank you @runthis for your feature request.
Let me address the two cases you mention one by one:
- I recommend wrapping a string in the translation function as early as possible, so your first example would look like this:
$words = [__('hello'), __('world')];
- For the second case, I would recommend using persistent strings:
{{ sprintf( __("Your name is %s and you are awesome!"), $name) }}
The comments you're proposing is nothing else than a new meta-language on top of what we already have, similar to PHP annotations, which I'm personally not a big fan of because it adds extra complexity to the language without significant benefits (IMO).
Let's ask other users of the project whether they need this feature by starting a simple voting process.
Folks, please comment with +1 if you need this feature.
from laravel-translatable-string-exporter.
Thank you for this amazing tool, it definitely helped me get up and running on a project.
Unfortunately as it progressed, I needed strings inside of methods (like if a sprintf was used) and also inside of specific database tables and columns, among other features as mentioned above, and it all be automated, so I rolled my own artisan command that takes care of blade files, and pulling info from the database by creating my db schema in a way that makes it feasible. I'll continue using your awesome tool for other projects though!
In case anyone is curious on the regex. It is not perfect by all means, but it suits my scenario.
{(?:\s+?)?{(?:\s+?)?(?:.+?)?__\((?:\s+?)?(?:'|\")(.+?)(?:'|\")(?:\s+?)?(?:\)|,)(?:.+?)?(?:\s+?)?}(?:\s+?)?}
The regex explained:
{ // Opening curly brace
(?:\s+?)? // Optional spacing
{ // Opening curly brace
(?:\s+?)? // Optional spacing
(?:.+?)? // Optional function
__\( // Begin translation function
(?:\s+?)? // Optional spacing
(?:'|\") // Single or double quote
(.+?) // Actual string to capture
(?:'|\") // Single or double quote
(?:\s+?)? // Optional spacing
(?:\)|,) // End translation function, basically
(?:.+?)? // Ending optional function
(?:\s+?)? // Optional spacing
} // Ending curly brace
(?:\s+?)? // Optional spacing
} // Ending curly brace
We can close this feature request down for now. Thanks again!
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
- Undetected strings if "key"-argument starts on new line HOT 4
- Does not support new Laravel 9 directory structure HOT 12
- 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.