|
Helping ordinary people create extraordinary websites! |
Internationalisation and my PHP Development InfrastructureBy Tony Marston2005-07-17
My Implementation - Directory Structure My main development infrastructure consists of a series of discrete subsystems each of which has its own directory in the file system. (Note that my sample application consists of just a single subsystem). Each of these directories will contain the following new subdirectories:
Each of these new directories will be further broken down into subdirectories where the subdirectory name matches a language code, such as:
All subdirectories except 'en' English (my native language) are optional. The files in the 'en' subdirectories identify every piece of text which can be translated, so these should be used as the patterns for any non-English translations. Each language subdirectory will contain a copy of the file(s) containing the text for that particular language code. If there is no text for a particular language code then there should be no subdirectory for that language code - in other words, there should not be any language subdirectories which are empty. I also decided to split the existing 'screens' directory (for the screen structure files) into language subdirectories with the intention to use these files to contain the translated field label text, but when I realised that most of the labels were duplicated I decided that it would be easier to define each field label just once in the file which contains all the other translatable text. However, I decided to keep the facility for separate versions of the screen structure files for different languages just in case it should be necessary to adjust more than the label text to suit the needs of a particular language. If no adjustments need to be made to any of the screen structure files then no additional language subdirectories will be necessary as everything will still work successfully with the original files in the 'en' subdirectory - the structures will be identical, but the label text will still be translated. Tutorial Pages: » Introduction » Possible Methods » Design Decisions » My Implementation - Directory Structure » My Implementation - File Names » My Implementation - Determine User Language » My Implementation - Locate Language Subdirectory » My Implementation - Load Screen Structure file » My Implementation - Get Language Text » My Implementation - Get Language Array » My Implementation - Handling Dates » My Implementation - Handling Numbers » Conclusion » References |
|