The Loop

Where humor doesn’t work.
Dec 19, 2017 13:52
I don't get it. What do you mean?
Dec 19, 2017 13:47
@MarkKaplun Yeah, for quite some time already
Dec 18, 2017 12:04
Since FF57 I don't really see that any more.
Dec 18, 2017 11:07
Stay with Firefox. Yes the issue @fuxia linked isn't nice, and it wasn't the first one. But it's still way better than anything else if you ask me. (Closed source or owned by Google)
Dec 7, 2017 14:11
Do you have xdebug or some other debugger in your setup? You can have a look into /wp-includes/l10n.php
Dec 7, 2017 14:07
Ah okay that might be it. Try wrapping your call like this
add_action( 'plugins_loaded', function(){ echo __("test", 'cardio');die(); }, 11 );
Dec 7, 2017 14:00
But Robin doesn't generally seem to care about doing it the WP way, so... ;)
Dec 7, 2017 14:00
Technically you can, it is just really, really bad practice and breaks the parser for pot files
Dec 7, 2017 13:59
Oh, one more idea. You probably load the translation on the plugins_loaded hook. When do you call __()? Maybe you are too early?
Dec 7, 2017 13:51
Okay sorry, I'm out of ideas without seeing it and I should get back to my work now. But maybe someone else has an idea, this should work.
Dec 7, 2017 13:46
You do have the site/user language set to german in your case, right?
Dec 7, 2017 13:43
Does it work if you set it?
Dec 7, 2017 13:40
With the correct text domain as defined in the plugin header? developer.wordpress.org/plugins/internationalization/…
Dec 7, 2017 13:38
I don't see anything about loading the translation in your question.
Dec 7, 2017 13:35
Dec 7, 2017 13:35
And then you'll need Twig helpers for all i18n functions, not just __
Dec 7, 2017 13:35
Then you need to load that file.
Dec 7, 2017 13:34
Okay first you need to save it with e.g. Poedit so you get *.po and *.mo files.
Dec 7, 2017 13:32
You mean 1 or 2?
Dec 7, 2017 13:29
I am 99% sure the breakdown of your approach is an issue with tooling and not the feature of WP itself. What you need is:
1. A tool that extracts strings from your Twig templates and creates a *.pot file from it.
2. Properly load the translation into WP.
Dec 7, 2017 13:27
Yes, just like PHP originally meant "Personal Home Page Tools" and wasn't meant for anything it does nowadays. Also if you think WP is unfit for the project you shouldn't use it and explain that to the client. But I won't get into that discussion. Let's get back to your actual issue at hand.
Dec 7, 2017 13:25
But hey, who am I to tell you what to do. ;)
Dec 7, 2017 13:25
If you want the UI of WP but want to have your own routing, templating and so on I'd recommend looking into the REST API WP offers. Or directly work with the DB. Or just don't use WP at all. I think what you're doing gets you the worst of both worlds.
Dec 7, 2017 13:22
As already said, even if you abort the routing you're still loading most of WP. Also I personally wouldn't feel comfortable selling something that only masquerades as WP if that is what the client requested. What would you say if you ordered a Symfony application and then what you get is something where the only Symfony thing is a Proxy that forwards all requests to a binary because I feel more comfortable writing Go?
Dec 7, 2017 13:16
I mean launching WP and then using nothing of it is quite a waste. You're site/application will be tremendously slower if it needs to init WP on each request. WP doesn't do any lazyloading so it always initializes the whole thing even if you only use the user part.
Dec 7, 2017 13:13
Okay, then why are you using WP at all instead of building a plain Symfony application?
Dec 7, 2017 13:12
3. As you have experienced a lot of the tooling also doesn't play to well with twig. For example various tools parse templates to extract strings for i18n which they won't detect in Twig unless you roll your own solution as well.
Dec 7, 2017 13:10
2.Then comes interoperability with Plugins and the wider WP ecosystem. E.g. by using Twig you are most probably bypassing the WP template hierarchy developer.wordpress.org/themes/basics/template-hierarchy which will cause all kind of compatibility issues with 3rd party code/plugins.
Dec 7, 2017 13:09
This isn't worth the hassle if you ask me.
Dec 7, 2017 13:08
So you can't easily run them before you're in the template. So you need a lot of Twig helpers (like the one you created) that pierce through the abstraction Twig is made to offer. Which kills all but one advantage over PHP templates: You might just like the format/style of Twig.
Dec 7, 2017 13:08
1. If you are using Twig to completely separate "Controllers" that prepare data and Twig really only assembles that this practically not doable with WP. A lot of WP core functions behave differently depending on when you call them. Some also shouldn't be run multiple times. (Which e.g. practically kills template inheritance in Twig)
Dec 7, 2017 13:04
That too. Generally I investigated and gave up on the idea. But let me elaborate:
Dec 7, 2017 13:03
Okay so I have played with Twig in WP myself. There are already various implementations (e.g. https://github.com/timber/timber or https://github.com/Rarst/meadow) all with their various advantages and disadvantages.
It really depends on what you are building...
Dec 7, 2017 13:01
Hi. I meant what you just did. :)
Nov 9, 2017 15:43
Basically I agree. Thing is that Gravatars e.g. are also used for WC attendee pages where people might not expect this behaviour. (I actually once wondered if that could be made into a nice "check if anyone in my address book is coming to the WC" app.) Anyway, there really are way worse things. Every page that includes Google Analytics/Fonts/CDN JS is hurting peoples privacy way more. So I don't share the overall excitement of Mark.
Nov 9, 2017 15:25
@MarkKaplun It's more complex than this. And I agree with Tom that I doubt Automattic is intentionally doing something nefarious here. It's just really risky to change something as ubiquitous as Gravatars. Here is an interesting read that also shows that just changing the hashing doesn't really solve everything: wordfence.com/blog/2016/12/…
Nov 8, 2017 16:11
Did you actually read the link I sent you?
Nov 8, 2017 14:28
That is only one part of it. All your internal links, attachments and anything else referencing the URL is still broken.
Nov 8, 2017 12:25
@MarkKaplun Automate it and you're good.
Nov 8, 2017 09:22
@R1ddler Because the database needs to be changed to the new URL: codex.wordpress.org/…
Nov 8, 2017 09:18
Taxonomies are meant exactly for that: Grouping things.
Nov 8, 2017 09:17
As I said, the term approach is good.
Nov 8, 2017 09:17
Well just add more custom_listuser meta with ids.
Nov 8, 2017 09:15
But then you can't do things like easily count how many people have a certain book on their list. Which you can do with the term approach.
Nov 8, 2017 09:14
If all you want to do is display that list you could also just store an array of CPT-IDs in a user meta field.
Nov 8, 2017 09:14
It really depends on what you want to do. (Surprise, not like it's always like that... ;) )
Nov 8, 2017 09:09
That should be fine.
Nov 8, 2017 08:13
@MarkKaplun You could probably do this with hooks. But what I personally do is using Capistrano or Deployer or alike for deployment.
What they basically do is create a new folder, git pull, composer install and whatever further preparations are needed. The webroot of the webserver then is a symlink to that folder. Repeat this for the next deployment. The symlink is only changed once everything is ready. So the site is never down/in maintenance mode.
Nov 6, 2017 15:17
Kind of, but I guess your question will be about something in relation to the publishing process which I don't do myself...