Jump to content

Recommended Posts

Posted

What is the difference between globalization and localization. Any one give some sample code.

 

Thanks in Advance

 

Globalization and localization generally refers to where a variable is declared, as well as from where it can be accessed. A global variable can be accessed from anywhere within a class, or in some languages, from outside the class (requiring the class be pre-loaded). A local variable exists only within a class or function or whatever, and depending on the language, can even share its name with other local variables in other parts of the program. The concept can also apply to functions and subroutines as well.

CLASS Example
	PUBLIC x AS INTEGER = 20 'Global variable
	SUB CountByN()
     	DIM n AS INTEGER = 7 'Local variable
     	x = x + n
	END SUB
	WHILE x < 100
     	TextBox1.text = TextBox1.text & x
     	CountByN()
	END WHILE
	TextBox1.text = TextBox1.text & n 'CRASH!! Because 'n' is not declared at this scope
END CLASS

 

This example is in ad-lib VisualBasic...I doubt it'd really work, because I don't think I can put a while loop outside of a function or subroutine, but it should give the idea...

Posted

Globalization is the use of shared data among several units at some level .. while Localization means using private data locally,

 

C++

int X = 1 ; // global

void function ()
{
    int X = 2 ; // local

    ::X = X ; // export data to global variable
}

void f2 ()
{
    printf("%d", X); // this will print ' 2 '
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.