-
Notifications
You must be signed in to change notification settings - Fork 4
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
Specify domain #4
Comments
Thank you ! Well I never did see such usage, could you let us know more about what this options is intended for ? |
Basically on my system I’ve subdivided everything into apps. Each app has its own unique language file in the form of po/mo in order to avoid the overhead of loading everything on every request when it’s just not needed.
The “core” file is however loaded in addition to every request, regardless of which app is being used. I need a way to be able to translate and switch between GetText domains while outputting the data, which works great in PHP because I can use dgettext, and I already have a custom class written just to make it a bit easier.
My problem comes with using Twig because I also need a way to say which domain to use for which string. The core app isn’t necessarily always set as the default domain as it depends on which app is being used, so the domain really needs to be included on every string instance.
Hope that makes a bit more sense 🙂
|
Thank you, this was very clear We use https://github.com/phpmyadmin/motranslator#object-api-usage in our code base to read mo files just in case you would need this tool :) The readme contains calls to If you to make a pull-request this will speed up implementing this feature |
Thanks for the suggestion. I'm in the rather fortunate position of actually being able to run GetText natively because my host doesn't use mod_php. But that package may well help me out in terms of other projects. I'm not that familiar with Twig's Extension markup, but I will take a look and see if I can put something together on this. |
I also have re-wrote the tool as https://github.com/wdes/php-I18n-L10n#how-to-use because of the GPL2 license contamination effect that I did not want on my project. You can use any of the 2 tools and it will call the native extension is available (if I am not mistaken) |
Signed-off-by: William Desportes <williamdes@wdes.fr>
4.0.0 is released 🚀 |
Not relating to PhpMyAdmin as a software, but in a custom Twig project I'm trying to use this code's fork. I've realised that I don't seem to be able to specify a domain with the translation string?
According to this SO link from several years ago, you could use code such as the following to translate from a specific domain: https://stackoverflow.com/a/7690325
i.e.
{% trans from "domain" %}text{% endtrans %}
Is this still a feature or has it been removed? I've checked through the extension code and don't seem to be able to find anything hinting at this.
In my Twig I'm using code such as the following:
{% trans from "core" %}en{% endtrans %}
And I'm getting errors like the following:
(I have great admiration for what you've done here, by the way. And I'm very grateful you guys have actually continued this fork, as I'm sure countless others will be as well)
The text was updated successfully, but these errors were encountered: