The project has a wide variety of copywriting, often appearing if what, what the case is. Write the hint text directly in the function code, 1. Difficult to see, 2. To modify the time to find trouble, but if placed in the configuration file, the configuration file to put a variety of copy, the file will be very large, when the need for these files, loading the contents of the configuration file also seems to waste overhead. I don't know which way is better, or there is no better solution.
Reply content:
The project has a wide variety of copywriting, often appearing if what, what the case is. Write the hint text directly in the function code, 1. Difficult to see, 2. To modify the time to find trouble, but if placed in the configuration file, the configuration file to put a variety of copy, the file will be very large, when the need for these files, loading the contents of the configuration file also seems to waste overhead. I don't know which way is better, or there is no better solution.
The copy you're talking about is supposed to be a suggestive language, right? Personal feeling or put the configuration file is better, after all, hard code this thing is not good maintenance, long time may not know where to write. I am more curious is this hint of text will not be a lot of it, can be loaded when the extent of the burden? If let me do, I will put the configuration file or write a separate file to load on demand, later maintenance is very convenient.
Which day needs you to do international processing ...
This thing is best encapsulated in a resource file.
As far as possible to separate the logic and resources, copy belongs to the resources, access and display belong to logic, this kind of follow-up development comfortable many
You said this kind of copy and pictures, videos and other no difference, should be summed up as resources management, how to manage to see the project needs. Large section of the text is generally used CMS, which is why most open source products are CMS or include CMS reasons. If it is a small paragraph of text usually consider the use of internationalization of this solution, is the use of specialized language files, such as the use of PO this way, and the use of specialized poedit and other software to manage such files.
If you think this is not worth it, you can consider the configuration file, the appropriate use of the cache does not lead to any performance loss, your profile can be more than the journey to a long time? Even 10M is not used.