This post is a continuation of the previous post Separating Code and Text: Thinking Out Loud . This time we will go a little further and present a possible API, and also compare the workflow before and after. PHP and Laravel framework are used as an example, but it almost doesn't matter.
Thesis
In this post we are trying to figure out if you can noticeably improve the process of working with text in modern applications. By text we mean any elements of the interface, communications with users, and so on - that which is not part of the business logic in the source code. Simply put, these are files with templates, variables and parameters of the string type, and so on.
Current method # 1
First, let's look at the most primitive way of working with texts. This method is quite suitable for small applications and sites. The text is passed as a parameter inside the controller:
The text is part of the template:
Advantages of this method:
The programmer does not need to spend extra time
It is very easy to insert values ββfrom variables into the text
Minuses:
β - , - . ,
#2
Laravel, , , - . 1970-1980 i18n.
, . , , , , - :
:
, ,
, (, , )
:
, , . - ? - ?
, #1
""
, , ""
#3
. , - (, ):
:
, #1
:
, ,
2 β ,
. ( , )
,
, . - ( __()
) (, @p
):
:
. , β , . , , .
p
:
__()
, ,
,
, β ,
, , - CI/CD β API , , , .
. .
#1
, . , , :
:
, - , - . ( - product manager) , - :
:
, . -. . , .
β . , .
#2
β , . X Y, , :
: " - ?", : ", ", . , , :
#3
, , , - β , , . 30 , , 50 β , . , , .
, ru_RU
β , ru_RU-
.
#4
A/B. , β , - , - . . , - :
home.blade.php
home__treatment.blade.php
, control- , , treatment- β , . , . , (, Google Analytics) , .
, "A/B-":
:
(, Google Analytics) (control treatment) , . Bounce Rate , β , . .
#5
( Gengo) , ;)
, - β , , , #2 #3. , - .
You can control the practice of text wrapping through a simple webhook, then all pull requests will be automatically checked:
Although I played around with the code a bit and verified that all of the above is possible, this article discusses a hypothetical product or utility. The purpose of the article is to collect opinions, your opinions.
Would you use such a thing?