Log message #4266147

# At Username Text
# Jun 22nd 2021, 16:08 slackebot1 'controller' => 'Users', 'action' => 'login', 'plugin' => 'CakeDC/Users' ] ) ?> <?php endif; ?>```
# Jun 22nd 2021, 16:08 kevin.pfeifer ```/** @var Authorization\Identity $identity */ $identity = $this->getRequest() ->getAttribute( 'identity' ); <?php if( !empty( $identity ) ): ?> <?= $this->Html->link( sprintf('Logout (%s)', $identity->getOriginalData()->username), [ 'controller' => 'Users', 'action' => 'logout', 'plugin' => 'CakeDC/Users' ] ) ?> <?php else: ?> <?= $this->Html->link( 'Login', [
# Jun 22nd 2021, 15:52 NMND Sers. Total Newb using v4.x here. Got through the tutorial. I will need some tutoring until I understand how this works. I HTMLd myself a few buttons into default.php. Now I'd like to replace the login button with a logout button when the user is logged in. Anyone able to spoonfeed or post a up2date tutorial?
# Jun 22nd 2021, 13:00 erwane it's pretty cool to have localized URL's but .... not really usefull and SEO is not only based on that.
# Jun 22nd 2021, 12:57 david Thank you guys... I think I will desist in this
# Jun 22nd 2021, 12:56 erwane Now i'mu using the AdMad i18n plugin and don't translate routes.
# Jun 22nd 2021, 12:56 erwane Package : <https://packagist.org/packages/erwane/cakephp-i18n-url> Source : <https://github.com/Erwane/cakephp-i18nUrl/tree/4.x> I abandonned the idea. Very complex to maintain. But it work like that : https://pastebin.com/jzXgWJrN
# Jun 22nd 2021, 12:48 erwane I've done something like that earlier. I'll check if code is public
# Jun 22nd 2021, 12:36 kevin.pfeifer puh, I haven't dealt with these "translation depths" so sorry, I can't help you any more ,:)
# Jun 22nd 2021, 12:35 david and I dont't want to du'plicate each url in router.php
# Jun 22nd 2021, 12:34 david because I can't translate strings in router.php
# Jun 22nd 2021, 12:34 david No, I have a function "actionDispatcher"
# Jun 22nd 2021, 12:33 kevin.pfeifer and are you translating urls via `__d('urls', '/english-slug');` ? So do you manually set new routes in your config/router.php if you change some slugs?
# Jun 22nd 2021, 12:32 kevin.pfeifer the whole translation system relies on the fact, that you stick with one language in your source code and that base language is being translated to whatever is currently active. Therefore your desired functionality can't work.
# Jun 22nd 2021, 12:27 david I18n::setLocale('es_ES'); echo __('hola'); // prints "hola" I18n::setLocale('en_GB'); echo __('hola'); // prints "hello" The problem, because I am trying to translate a translation: I18n::setLocale('es_ES'); echo __('hello'); // prints "hello"
# Jun 22nd 2021, 12:24 dereuromark you could switch the translation language at runtime for each, and then reset. but it might be easier to just hardcode this one then.
# Jun 22nd 2021, 12:23 david when I "paint" the link to change to spanish version, I can't obtain the spanish string because I am trying to translate __d('urls', '/english-slug');
# Jun 22nd 2021, 12:22 david the problem is when I am in english (mydomain.com/en)
# Jun 22nd 2021, 12:22 david no, that works fine
# Jun 22nd 2021, 12:21 kevin.pfeifer but when changing to english, you want to load the text from the `en/default.po` and it doesn't`
# Jun 22nd 2021, 12:21 david in spanish there is no problem
# Jun 22nd 2021, 12:21 david yes, that is
# Jun 22nd 2021, 12:20 kevin.pfeifer so your spanish text is all good and if your current active language is spanish then everything is fine, right?
# Jun 22nd 2021, 12:18 david so, if translation doesn't exists, I get the spanish string
# Jun 22nd 2021, 12:18 david I only have "/en" translations
# Jun 22nd 2021, 12:17 david my default lang is "es", so "/es" doesn't exists
# Jun 22nd 2021, 12:17 kevin.pfeifer so do you have ```/src /Locale /en default.po /es default.po```
# Jun 22nd 2021, 12:14 david 3
# Jun 22nd 2021, 12:14 kevin.pfeifer first of all, are you on cakephp 4 or 3?
# Jun 22nd 2021, 12:14 david it is correct
# Jun 22nd 2021, 12:13 kevin.pfeifer so you are outputting your text via `__('English')` but it is being translated because your current language not englisch
# Jun 22nd 2021, 12:12 kevin.pfeifer i guess i know what the problem is
# Jun 22nd 2021, 12:12 david Iterating the translations is not a problem, but when I am in a translation, I can't figure how to get the default language string
# Jun 22nd 2021, 12:11 david yes, it should be different
# Jun 22nd 2021, 12:10 kevin.pfeifer by "each language" i mean each "currently active language"
# Jun 22nd 2021, 12:07 kevin.pfeifer and the text shown in your language dropdown should be different for each language, right?
# Jun 22nd 2021, 12:05 david my current url es mydomain.com/en/categories and I want to change to to mydomain.com/es/categorias
# Jun 22nd 2021, 12:04 david for example
# Jun 22nd 2021, 12:03 kevin.pfeifer what do you mean by the current section?
# Jun 22nd 2021, 12:00 david I want to change the language, but keep in the current section. So I need to know the url segment of the current url
# Jun 22nd 2021, 11:58 david I am trying to do a dropdown menu for changing the language of the current url