trejder
trejder

Reputation: 17495

Replace text everywhere within Yii application

I'd like to replace -- string with — globally, everywhere within my Yii 1.x application (in every view, in strings generated by controllers or queried from database, everywhere).

What would be the best approach / solution to achieve this.

EDIT: I need to do this in the code, of course. It is not a question about, how to do this in the IDE, but using Yii.

Upvotes: 0

Views: 114

Answers (1)

Felix Ivan
Felix Ivan

Reputation: 51

I believe you can use several ways. If you are not planning to set up i18n on your system you can handle it with Yii::t expression

    $result = Yii::t('common', 'May is a {{ rainy }} month', [
                '{{ rainy }}' => 'sunny',
    ]);

Otherwise, you can simply go with native PHP functions such as str_replace https://www.php.net/manual/es/function.str-replace.php and sprintf https://www.php.net/manual/es/function.sprintf.php

Upvotes: 1

Related Questions