Separating Code and Text: Prototype

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, , :





: " - ?", : ", ", . , , :





Hypothetical preview (render)
()

#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?








All Articles