Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Internationalization (v4)
 === GUIDELINES #4: WRITING V4 COMPATIBLE MODS
 Forum Locked  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  14:07:04  Show Profile
=== CHAPTER 4: WRITING V4 COMPATIBLE MODS

DISCLAIMER: The following is not the final decision and open to any kind of input from MOD writers. This is valid for v4b03.003 and will be valid until it is redefined.

CAUTION: It may/will be necessary for MOD writers to re-touch their code to make their MODs fully v4 compatible when v4final is released, especially because that versions utilities will ease compatibility across different systems.

This topic is locked because I want it to be read-only. We can dissuss related issues in the topic Discussion Topic for Guidelines #4. Whenever ideas evolve, I will carry them here editing posts and/or adding posts to this topic.

#4 in the title represents that this is the 4th chapter for the documentation which will be released with v4final. Other chapters will come later.


This Guideline contains the following sub-topics:
  • 4.1 MODS IN GENERAL

  • 4.2 GENERAL ISSUES

  • 4.3 LANGUAGE FILE STRUCTURE FOR MODS

  • 4.4 VARIABLE NAMING FOR MOD LANGUAGE STRINGS

  • 4.5 LANGUAGE FILE EXAMPLES

  • 4.6 DISTRIBUTION AND APPLICATION ISSUES

  • 4.7



Edited by - bozden on 09 March 2002 15:31:12<

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  14:14:13  Show Profile
4.1 MODS IN GENERAL

After dealing with internationalization of a couple of MODs (namely Events Calendar, Guestbook, Links Manager, Mail List Message Manager, Active Users) I think that the following provides a good working solution. Although not every kind of MOD is examined, categorization of the mods can be done as follows (see below for more details):

SIZE: Large Scale MODs vs Small Scale MODS
STANDALONE: MODS changing base forum code vs Standalone MODs
DATABASE: MODs changing the database structure vs those using the existing structure only


SIZE:

  • There are "small scale" MODs (having 1-3 files/file changes, and less than 30-50 language strings), where you can use LangMODS.asp file to store them (active_users and Mail List Message Manager mods fall in this category - at least the versions I used. See below for more details)

  • There are "large scale" MODs (having a lot of files/file changes, and more than 50-60 language strings), these must have a separate LangMODS_MODIDENTIFIER.asp file to store the DIM's and include its own language files LangMODS_MODIDENTIFIERNNNN.asp

  • If you are just at the border of small and large, use large scale as future versions of your mod will usually contain more strings.

  • There will be a performance difference between the two as the number of language file includes will change. Small scale MODs language resources will be loaded with every page hit, but will be ready to be used. On the other hand, large scale MOD idea uses more includes, but has the chance to be used only if that MODs page is called (meaning included by only that mods asp files).

  • There will be a distribution/installation difference between the two. Large scale mod language resources will be easier to distribute/install, whereas small scale mods will need some (simple but careful) copy-paste operations.

  • I would like to have a more general rule valid for every mode, but performance matters.




STANDALONE:

  • If the mode changes the base forum asp files (such as default.asp) and does not add too many language strings, it will be better to consider them as small scale mods (the strings will be ready for use, no need to put some more includes for language resources).

  • If they are standalone, use the logic given above to determine the type.




DATABASE:

  • Database related issues are explained in chapter 4.2 GENERAL ISSUES




OTHER:

  • Please give a good and distinguishable name to your MOD. Also provide a short name to be used in language variables (the above mentioned MODs can have EVENTS, GB, LM or LINKS, MLMM, AU).* This will be used as your MODs <MODIDENTIFIER>.

  • Please keep good versioning info like "Events Calendar v2sr1 for Snitz Forums 2000 v4.0beta". Make sure to use that version info in your language resources. Otherwise the language files will be messed by the users.

  • It is wise to prefix each of your files with a common name like EVENTS_*.*. Do not use general names like readme.txt, language.asp which can overwrite other files. Instead use, EVENTS_readme.txt etc.




Edited by - bozden on 09 March 2002 16:42:17<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  14:18:31  Show Profile
4.2 GENERAL ISSUES

The following are worth to mention:

The new table names, new field names created by the MOD must consist of UPPERCASE English ASCII charset for compatibility reasons.

Use these for table names:

LINKS
FORUM_SPAM


Do not use these:

Links
FORUM_spam



Use these for field names:

LINKS_CAT_ID
SPAM_MESSAGE


Do not use these:

Links_Cat_id
cat_id
Spam_Message



It is also wise to prefix each field name with the MOD name like:

LINK_ID
LINK_NAME


instead of

ID
NAME



Any SQL statement accessing the database (no matter new or old) must use UPPERCASE English ASCII charset

Use these

strSql = "SELECT CAT_ID FROM LINKS;"


instead of

strSql = "select cat_id from links;"


Otherwise, some database versions will fail to convert some characters to uppercase. (PS: In the process of making above mentioned MODs v4 compatible, I corrected many problems of this kind).

ADDED NOTE: Actually (technically) it is enough to make them case-compatible, i.e. if you use Cat_Id in field name AND if you use Cat_Id in SQL query, it will work. However, the standart used in SNITZ is to use ENGLISH UPPERCASE ASCII set in definitions AND in SQL Queries. If you don't care on these quides, you will most likely have problems and support issues whenever users start to use your MODs in different systems.

If the MOD uses mod-specific image files, and these have textual info in them, name them so that it can be switchable by the software
For example, if a content management mod uses an icon content_edit.gif with the word "edit" on it, take care of these:

  • Use LangNNNNcontent_edit.gif as the name, where NNNN is the LCID value

  • Refer to that file in your code as

    <img src="Lang<%= strLangLCID %>content_edit.gif" width="30" height="10">

  • Do not forget to provide additional space in the image for longer words in other languages (e.g. Turkish counterpart of "edit" is "düzelt" which needs more space. This may need to use a larger picture, needing change in the code (width= in this case), or the text will get distorted.

  • Generally try to avoid text in images, use iconic images.




If the MOD is configurable through setting some values to some variables, the language files can be used for this purpose.
This will also prevent unnecessary xxxmod_config.asp files or direct edits in source code. For example I used in http://www.istanbulmuzesi.org thef ollowing for the Link Manager:

' === CONFIGURABLE PART ===
'## Links_affiliates.asp

strLangMODS_LinksIconNew = "Lang" & strLangLCID & "LinksNew.gif"
strLangMODS_Links06002 = "http://www.tarihvakfi.org.tr" ' configurable data
strLangMODS_Links06003 = "../resources/images/tv_logo_10yil_tr1.gif" ' configurable data
strLangMODS_Links06004 = "History Foundation of Turkey" ' configurable data
' === END CONFIGURABLE PART ===


Do never use textual data to keep in databases.
Use always a kind of coding. For example, instead of keeping gender information ("male","female" or empty for not selected) directly in the database, define 1 for "male, 2 for "female" and keep these.

Taking this into account, the code that accesses the database will change also a bit. Note: The following code is just for demonstration purposes. Don't forget, the other textual info will actually be language variables.

Instead of using this

response.write "Gender: " & rs("GENDER")


use this:

response.write "Gender: "
Switch Case rs("GENDER")
Case "1" response.write "Male"
Case "2" response.write "Female"
Case else response.write " "
end switch

Although the second case needs longer coding, it is more understandable and can be easily made international.


Edited by - bozden on 12 March 2002 12:38:38<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  14:20:43  Show Profile
4.3 LANGUAGE FILE STRUCTURE FOR MODS

The following is the file to be used for "small scale" MODs (already provided with the package, starting with v4b02+):

LangMODS.asp


With the following structure:



'...
'... standart copyright info is stripped out to save space in this topic ...
'...
'## SNITZ FORUMS 2000 v4.0 LANGUAGE FILE FOR SMALL SIZED MODIFICATIONS
'Notes:
'1) The LangMODS.asp file is introduced in v4.0beta022patch004
'2) Make sure that you have LangMODS.asp included at the very bottom of the config.asp file
'3) The content will be distributed by LangMODSNNNN.txt files.
' These files will be found in the packages of v4 compatible MODs.
'4) Change the LCID values in the case statements to the ones you use on your forum installation


'## DIM ALL LANGUAGE VARIABLES

'## END DIM'MING


select case strLangLCID
'################# TURKISH ####################
case "1055"
'################# MOD name
' ## filename1
strLangMODS_MODIDENTIFIERNNNNN = "String in Turkish"
...
' ## filename2
strLangMODS_MODIDENTIFIERNNNNN = "String in Turkish"
...

'################# MOD name
' ## filename1
...

'################# ENGLISH ####################
case "1033"
'################# MOD name
' ## filename1
strLangMODS_MODIDENTIFIERNNNNN = "String in English"
...
' ## filename2
strLangMODS_MODIDENTIFIERNNNNN = "String in English"
...

'################# MOD name
' ## filename1
...

end select




The following are the file naming to be used for "large scale" MODs:

Base language file:

strLangMODS_<MODIDENTIFIER>.asp


Language resource files:

strLangMODS_<MODIDENTIFIER><NNNNN>.asp



where

<strLangMODS_> is a fixed prefix for ALL MOD language files
<MODIDENTIFIER> is a unique name for the mod (may be acronym/abbreviation)
<NNNNN> is the LCID value




The base language file is used to define the variables and include additional language resources. It has the following structure:

'## SNITZ FORUM 2000 MOD LANGUAGE FILE

'## DIM ALL LANGUAGE VARIABLES

DIM strLangMODS_MODIDENTIFIERNNNNN, strLangMODS_MODIDENTIFIERNNNNN
...
DIM strLangMODS_MODIDENTIFIERNNNNN
'## END DIM'ING

select case strLangLCID
case "1055"%>
<!--#INCLUDE FILE="LangMODS_MODIDENTIFIERNNNNN.asp" -->
<%case "1033"%>
<!--#INCLUDE FILE="LangMODS_MODIDENTIFIERNNNNN.asp" -->
<%end select%>



The language resource files are used to define actual strings in one language. These files will be included in the base language file (see above). It has the following structure:

'...
'... standart copyright info is stripped out to save space in this topic ...
'...
'... STANDART FILENAME/DESRIPTION/COMPATIBILITY/AUTHOR/TRANSLATOR/LANGUAGE/LAST MODIFIED/... info
' === CONFIGURABLE PART ===
'## put any configurable variable based data here

....
' === END CONFIGURABLE PART ===

'## filename1
strLangMODS_MODIDENTIFIERNNNNN = "String in this language"
strLangMODS_MODIDENTIFIERNNNNN = "String in this language"
...
'## filename2
strLangMODS_MODIDENTIFIERNNNNN = "String in this language"
...
'## filenameN
strLangMODS_MODIDENTIFIERNNNNN = "String in this language"
...
%>



Edited by - bozden on 09 March 2002 15:53:04<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  15:24:08  Show Profile
4.4 VARIABLE NAMING FOR MOD LANGUAGE STRINGS

General naming for MODs language strings:


<strLangMODS_><MODIDENTIFIER><NNNNN>


where:

<strLangMODS_> is a fixed prefix for ALL MOD language strings
<MODIDENTIFIER> is a unique name for the mod (may be acronym/abbreviation)
<NNNNN> is a unique numbering scheme (see below)


This way, one can locale all MOD strings (searching for "strLangMODS_") or strings for a specific MOD (searcing for "strLangMODS_MODIDENTIFIER") easily. It will also give enough flexibility for future MOD or forum releases.

NNNNN:
start with 10
increment it by 10 in a file.
increment by 1000, and sart with 10 in the next file.

Example (from LangMODS_Links1033.asp):

<% '## Links.asp
strLangMODS_Links00001 = "All Forums"
strLangMODS_Links00002 = "Links Manager"
'## Links_menu.asp
strLangMODS_Links01001 = "Add URL"
strLangMODS_Links01002 = "New Links"
strLangMODS_Links01003 = "Popular Links"
strLangMODS_Links01004 = "Top Rated"
strLangMODS_Links01005 = "Random Link"
strLangMODS_Links01006 = "search"
strLangMODS_Links01007 = "Results :"
'## Links_add_form.asp
strLangMODS_Links02001 = "Submit URL"
strLangMODS_Links02002 = "Category:"
strLangMODS_Links02003 = "Website Title:"
...


With this scheme, your MOD can have 99 files, 99 strings per file (if there are more, increment it by one - resulting in 999 strings).

NOTES

  • Do not allow unnecessary multiple definitions for the same string in one file. You may allow (or not allow, if you want to make it more flexible) multiple definitions.

    For example never have:

    strLangMODS_Links02010 = "Submit URL"
    strLangMODS_Links02110 = "Submit URL"


    But it will add some flexibility to have (it will same some space/translation if you don't do this. I preferred not to have such duplicates!!!):

    ' file 1
    strLangMODS_Links00010 = "Submit URL"
    ...
    ' file 3
    strLangMODS_Links02110 = "Submit URL"
    ...


  • Start with the main file of your mod. Especially if you do not allow multiple definitions of the same string, this will save coding/translation/adaptation time.

  • Number the strings in the same file from top to buttom. This will ease the location of them in the future.



IMPORTANT NOTE:
If the MOD you are using adds new language variables to base forum files (such as default.asp, active.asp), DO NOT FOLLOW the forum standart for naming, but USE THIS SCHEME!

For example, if you add a field called "PHONE" to the members database and want to ask for this in inc_profile.asp, do not make additions to LangNNNNN.asp files (base forum language files), but use LangMODS.asp file to define it as:

strLangMODS_UserFields00010 = "Phone Number:"


and use this variable in inc_profile.asp like (code reformatted for readability):


<td bgColor="<% =strPopUpTableColor %>" align=right nowrap valign=top>
<b><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
<% =fLang(strLangMODS_UserFields00010) %> 
</font></b>
</td>



Edited by - bozden on 09 March 2002 16:12:07<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  15:25:54  Show Profile
4.5 LANGUAGE FILE EXAMPLES

You can download some examples of MOD language files from http://www.istanbulmuzesi.org/public/LangMODS_Examples.zip . These are provided as is and are not complete (e.g. Events Calendar is not compatible with the definitions above).

You can see them working in http://www.istanbulmuzesi.org .

Please do not ask for the MODs to be published as I have a lot of tweaks in them. They are not ready at all!


Edited by - bozden on 09 March 2002 16:19:57<
Go to Top of Page

Deleted
deleted

4116 Posts

Posted - 09 March 2002 :  15:26:49  Show Profile
4.6 DISTRIBUTION AND APPLICATION ISSUES

The problem with the packaging and distribution is the same as we have for main forum language files (even worse).


  • A mod has versions (and there is no standart versioning for mods)

  • A mod version is compatible for a set of Snitz Forum Versions (and usually there is no way of knowing the compatibility until you use them in each version)

  • A mod will have several language resources for each language (i.e. LCID value)



This can result in a not-easy-to-maintain resource pool. How about this:

French Language Resources for Events Calendar v2.5sr3 for Snitz Forums 2000 v4.0

We need a file naming standart for the packages (ZIP files).

A basic MOD package MUST already contain:

  • Every new ASP file the MOD introduces

  • New Image file the MOD introduces (files without text information)

  • Other support files (dbs, readme, etc - English only)

  • English-US (LCID=1033) Language Resources (see below)

  • (Optional) one other language resource for testing (see below).



A language resource for LCID=NNNN will contain:

  • New Image files the MOD introduces (having textual information, i.e. in LangNNNNxxx.gif format)

  • LangMODS_MODIDENTIFIER.ASP file

  • LangMODS_MODIDENTIFIERNNNN.ASP file

  • A standart LangMODS_MODIDENTIFIERNNNN.txt file which tells about the installation to LangMODS.asp or as is.



I have no idea how such a ZIP file can be renamed, but I'm sure we need to define a standart. Otherwise users will have a major trouble.


...to be continued ...


Edited by - bozden on 09 March 2002 16:39:37<
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07