dandju Posted December 30, 2020 Share Posted December 30, 2020 Hi, Is it possible to translate the "diffForHumans" date strings within the client area? (using WHMCS 8.1) Eg. in the right-side Ticket Information box on a ticket, it says "Last change: 5 months ago" - I would need to change the "5 months ago" to another language (preferable to that used by the logged in customer). As I assume the Carbon's diffForHumans function is used here, I have tried to set it in the configuration.php file to "Carbon\Carbon::setLocale('de');" ... but did not work - I assume it gets overwritten somewhere in the WHMCS core. Any ideas? Thank you! 0 Quote Link to comment Share on other sites More sharing options...
dandju Posted December 30, 2020 Author Share Posted December 30, 2020 Same for the /cart/domain/renew page Expire date: 15 Jan 2021 (2 weeks from now) Don't know if this is also Carbon, but couldn't find any translation string in the English.php lang file. And "15 Jan 2021" does also not match the chosen date format in the WHMCS settings ... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 31, 2020 Share Posted December 31, 2020 15 hours ago, dandju said: Eg. in the right-side Ticket Information box on a ticket, it says "Last change: 5 months ago" - I would need to change the "5 months ago" to another language (preferable to that used by the logged in customer). are you using a custom theme? sidebars would be on the left by default..it should already translate... what are you seeing ? 15 hours ago, dandju said: Same for the /cart/domain/renew page Expire date: 15 Jan 2021 (2 weeks from now) if I look at the domain renewals page in 21 or Six, then I see.... i'm only checking in v8.1b1 (as I haven't updated yet), but I assume the GA release hasn't broken this. 0 Quote Link to comment Share on other sites More sharing options...
dandju Posted December 31, 2020 Author Share Posted December 31, 2020 (edited) Thanks Brian for the update. Sorry, yes on the left side; using the default "twenty-one" theme. BUT I have just noticed that this only applies to some languages - I guess to those that are not by default shipped with WHMCS. German is indeed working fine; the language in my case that does show english diffforhumans is "Bosnian" (which is similar to Croatian, which is working fine). Do you by chance now how I can set the ISO code that will be passed to Carbon? Or how the language is passed to Carbon? Tried to set $_LANG['locale'] = "hr_HR"; in the translation file, but this did not work. Thanks! And happy new year! Edited December 31, 2020 by dandju 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 31, 2020 Share Posted December 31, 2020 the Carbon translations are available in /vendor/nesbot/carbon/src/Carbon/Lang and I can see three files in there... hr.php hr_BA.php hr_HR.php i'm assuming the hr_BA.php contains Bosnian strings, but you'd be able to confirm that better than me... they look to be modified versions of the files available at the Carbon GitHub site. however, I don't know whether WHMCS owns these files in the sense that if you were to modify them, they will just get overwritten during an update - my suspicion is that they would. you could try defining hr_BA in the locale field, but i'm not sure it would work (even if you reset the value with a hook). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.