clarkwinkelmann it is not found inv1.1.1
i will try after updating. thanks flarum doc
Linguist, customize translations with ease
Hari the strings will only appear when running Flarum 1.2
It's me again, this really a great extension
Coming to the question, how can change email username. I mean flarum sends emails right and I want to modify username. by default it's site name.
Ask YouTube
to AskYouTube
If you ask me why i want to do that, because in Gmail app they only show first word not the full user name .. if the name has space they will skip the second word.
In wordpress we use SMTP plugin to define sending user name and email subject. How can do it in flarum.
Don't want to touch core files.
Hari unfortunately Linguist can't help here because the translation system is not used for this.
It's relatively easy to make the change using some custom code in the root extend.php
file:
<?php
use Flarum\Extend;
class MailServiceProvider extends \Flarum\Foundation\AbstractServiceProvider {
public function register()
{
$this->container->extend('mailer', function ($mailer) {
$mailer->alwaysFrom(
$this->container->make('flarum.settings')->get('mail_from'),
'EmailFromName' // Change this string with your custom name
);
return $mailer;
});
}
}
return [
// Register extenders here to customize your forum!
(new Extend\ServiceProvider())->register(MailServiceProvider::class),
];
An extension could easily add this as a new field on the Admin > EMail page. I'm not sure why Flarum doesn't make the From name customizable. It's indeed hard-coded to be the forum name by default.
clarkwinkelmann thanks for helping with the code. i have a doubt if I updated my flarum will I lose this code which is present in extend .php file? > Hari
Hari The main extend.php file will not be overwritten, only the stuff in the vendor folder.
- Edited
Hari just to add a tiny bit to the answer of askvortsov: Here is an old topic with slightly "extended" information on what may be overwritten: https://discuss.flarum.org/d/29300-project-directory-not-empty-error/4
me again , when my server gets stuck due to heavy load flarum throws an error saying "flarum Encountered Boot Error" how can i change this error message?
i want it to be generic saying We Encountered Boot Error
don't want to confuse my users with the word "flarum"
Hari unfortunately that error message cannot be customized. It's hard-coded on purpose because on boot error the translation system might not be available.
It's not supposed to be visible unless something went terribly wrong though. What is the actual error behind the scene? You might be able to solve/detect the issue at that level and react accordingly.
For instance if it's the database that receives too many connections, a Flarum extension could detect it before it's too late and offer a custom error page for that situation.
clarkwinkelmann true but at the same time i can not divert my users saying "flarum" i request to edit this at the core level to We Encountered Boot Error
in later versions of flarum.
- Edited
Hari we can certainly discuss a change for core, but in my opinion it's important that the error message contains the word "Flarum" so a forum administrator understands which part of the software is throwing the error. Otherwise it's difficult to tell whether it's an error at the webserver level or at the Flarum level. It speeds up troubleshooting a lot when you know what fact.
You might be able to change your webserver configuration to force a given HTML file to be rendered for all 500 errors.
Changing the message in Flarum locally will require some Composer tricks to provide an override file, or place the overridden class in a different namespace and call it from index.php
. I don't think it's possible to just wrap everything in a new try/catch block, because the bit of code where this message is hard-coded is the big try/catch block that catches everything the regular Flarum error handler can't handle.
But again, that page is not supposed to be visible under normal operation. Feel free to open a new issue/discussion about your actual 500 error so we can see if we can handle this situation more gracefully and not end up with a boot error in the first place.
clarkwinkelmann sure, i have deleted old logs once I face the same issue again i will start a new discussion with log
- Edited
clarkwinkelmann How to add new language to translate to it i mean like in the topic picture
english (en)
italiano
instead of translating strings to my desires lang in field of All
AhmedShiboub languages need to be registered by a language pack. This extension is then intended for changing or completing the existing translations.
If you want to translate for a language that doesn't have a language pack yet, you would have to create the pack, even with no translations inside, just to define and enable the language. This shouldn't be an issue for Italian since I assume a pack is available.
If you already have the language installed, make sure it's enabled. To complete missing translations, you also need to have one other language pack enabled that contains those missing translations in a different language, so it's best to keep English enabled during this process to make sure every single string gets listed. You can disable English once you're done translating.
- Edited
clarkwinkelmann can i download an arabic package even it is incompatible then retranslated it using linguist extension cauz translation using weblate is exhausting to me especially many refreshing the page after each string translation
AhmedShiboub the pack needs to be compatible with your Flarum version, it just doesn't need to be complete.
If you have control over the source code of an existing pack, there shouldn't be a lot of work to get to that stage from a language pack that was only compatible with Flarum beta. You might need to switch the code in extend.php
with a new extender and replace the required Flarum version in composer.json
.
If you are planning to translate an entire language, working directly in Yaml format in the language pack source code shouldn't be too much additional effort compared to using Linguist. And you have the benefit of being able to re-distribute the pack easily once done.
clarkwinkelmann Ok i want to translate into my language but i dont understand programming so what should i do?
AhmedShiboub This extension allows you to translate almost all text to any language. No programing language is required.
halimjr i know but i need a name of my language like Endlish (en) in the topic picture
- Edited
@clarkwinkelmann
I got this error on an instance deployed over freeflarum where I wanted to translate to Cyrillic and titles are in Cyrillic. This error is thrown and the page doesn't load when I open a link to a post directly, if I open the root URL its fine. Any ideas?
Next Symfony\Component\Translation\Exception\InvalidArgumentException: Invalid message format (error #65807): msgfmt_create: message formatter creation failed: U_DEFAULT_KEYWORD_MISSING in /app/vendor/symfony/translation/Formatter/IntlFormatter.php:43
Stack trace:
#0 /app/vendor/symfony/translation/Formatter/MessageFormatter.php(54): Symfony\Component\Translation\Formatter\IntlFormatter->formatIntl()
#1 /app/vendor/symfony/translation/Translator.php(223): Symfony\Component\Translation\Formatter\MessageFormatter->formatIntl()
#2 /app/vendor/flarum/core/src/Frontend/Driver/BasicTitleDriver.php(41): Symfony\Component\Translation\Translator->trans()
#3 /app/vendor/flarum/core/src/Frontend/Document.php(221): Flarum\Frontend\Driver\BasicTitleDriver->makeTitle()
#4 /app/vendor/flarum/core/src/Frontend/Document.php(204): Flarum\Frontend\Document->makeTitle()
#5 /app/vendor/flarum/core/src/Frontend/Document.php(195): Flarum\Frontend\Document->makeView()
#6 /app/vendor/flarum/core/src/Frontend/Controller.php(32): Flarum\Frontend\Document->render()
#7 /app/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Frontend\Controller->handle()
#8 /app/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http\{closure}()
#9 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ExecuteRoute->process()
#10 /app/vendor/fof/oauth/src/Middleware/ErrorHandler.php(50): Laminas\Stratigility\Next->handle()
#11 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): FoF\OAuth\Middleware\ErrorHandler->process()
#12 /app/vendor/fof/secure-https/src/Middlewares/ContentSecurityPolicyMiddleware.php(32): Laminas\Stratigility\Next->handle()
#13 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): FoF\SecureHttps\Middlewares\ContentSecurityPolicyMiddleware->process()
#14 /app/vendor/flarum/core/src/Http/Middleware/ContentTypeOptionsHeader.php(21): Laminas\Stratigility\Next->handle()
#15 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ContentTypeOptionsHeader->process()
#16 /app/vendor/flarum/core/src/Http/Middleware/ReferrerPolicyHeader.php(30): Laminas\Stratigility\Next->handle()
#17 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ReferrerPolicyHeader->process()
#18 /app/vendor/flarum/core/src/Http/Middleware/FlarumPromotionHeader.php(30): Laminas\Stratigility\Next->handle()
#19 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\FlarumPromotionHeader->process()
#20 /app/vendor/flarum/core/src/Http/Middleware/ShareErrorsFromSession.php(57): Laminas\Stratigility\Next->handle()
#21 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ShareErrorsFromSession->process()
#22 /app/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(36): Laminas\Stratigility\Next->handle()
#23 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\CheckCsrfToken->process()
#24 /app/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(67): Laminas\Stratigility\Next->handle()
#25 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ResolveRoute->process()
#26 /app/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle()
#27 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\SetLocale->process()
#28 /app/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle()
#29 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\AuthenticateWithSession->process()
#30 /app/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle()
#31 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\RememberFromCookie->process()
#32 /app/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle()
#33 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\StartSession->process()
#34 /app/vendor/flarum/core/src/Http/Middleware/CollectGarbage.php(46): Laminas\Stratigility\Next->handle()
#35 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\CollectGarbage->process()
#36 /app/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle()
#37 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ParseJsonBody->process()
#38 /app/vendor/migratetoflarum/canonical/src/Middlewares/CanonicalRedirectMiddleware.php(49): Laminas\Stratigility\Next->handle()
#39 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): MigrateToFlarum\Canonical\Middlewares\CanonicalRedirectMiddleware->process()
#40 /app/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle()
#41 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\HandleErrors->process()
#42 /app/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle()
#43 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\InjectActorReference->process()
#44 /app/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(76): Laminas\Stratigility\Next->handle()
#45 /app/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process()
#46 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\RequestHandler->process()
#47 /app/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle()
#48 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\BasePathRouter->process()
#49 /app/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle()
#50 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Laminas\Stratigility\Middleware\OriginalMessages->process()
#51 /app/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle()
#52 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Middlewares\BasePath->process()
#53 /app/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle()
#54 /app/vendor/laminas/laminas-stratigility/src/Next.php(51): Flarum\Http\Middleware\ProcessIp->process()
#55 /app/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(76): Laminas\Stratigility\Next->handle()
#56 /app/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(65): Laminas\Stratigility\MiddlewarePipe->process()
#57 /app/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle()
#58 /app/vendor/flarum/core/src/Http/Server.php(44): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#59 /app/public/index.php(22): Flarum\Http\Server->listen()
#60 {main}