1 / 17

More on locales

More on locales. Locale : A locale in POSIX has two components: 1.Collection of rules and text specific to a language in a specific geographic area(locale files) 2.Set of functions which can be used to set and use locale files.

rona
Download Presentation

More on locales

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. More on locales • Locale: A locale in POSIX has two components: 1.Collection of rules and text specific to a language in a specific geographic area(locale files) 2.Set of functions which can be used to set and use locale files. In short, I18N and L10n are carried out by preparing locale files based on the rules in component 1 so that the functions in component 2 can be properly defined for use

  2. Collation: A collation specifies a sorting order. • Example: Input output If you want A A a C B A a C b B a B b b C • Prepare a collation sequence LC_COLLATE order_start <a> <A> <b> <B> …...

  3. Open Systems • Open System is specifically designed to accommodate components from various vendors with three distinct perspectives: Portability, interoperability, and integration

  4. Portability:The aspect of a component that allows it to be used in various environments • Program portability: software that can be used in different language environment/platform • Data portability: Data produced by a program on a certain platform can be readily used on another platform/environment

  5. Interoperability: refers to the ability of individual components within an open system to exchange information with other components (which may be heterogeneous).

  6. Integration: is concerned with the consistency of various human-machine interfaces between an individual and all hardware/software in the system

  7. What is an Open system: an open system is one in which the components are built on some open specifications. • Why open systems: Enables competing organizations to use these standard components to build competitive systems. • Specification(規範,規定): a description of a system/component functionality through the description of its interface behavior. • Example: C library, parallel port

  8. Open system development architecture

  9. Technical Foundation of open system • An open system component must follow some open specification(規範) • We characterize technical aspects of open systems along three coordinates: If a system supports the exchange of information among various components of similar levels, then it supports interoperability. If a sub-system(component or part) can be moved from one environment to another, it is said to be portable. An integrated set of applications (components or parts) provides a consistent (user) interface.

  10. Examples: • Interoperability: X.25, TCP/IP, HTTP, • Portability: • Operating systems: POSIX, X/Open, • Data management: FTP, SQL • Programming languages: C, Fortran • Integration: • User programming interfaces: X, Motif, Microsoft Windows ActiveX,

  11. Writing Portable Software (a2): retrieve data and put in X ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<8; j++) getc(x[i+j], tape); ….. (a1): back up data in X … float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<8; j++) putc(x[i+j], tape); • The program assumes that a floating point number is 8 bytes in length • Save a floating point number as 8 bytes of characters

  12. What is the problem with (a)? • Is the Program Portable? • What if the data length for floating point number on different machines are different? • If longer: Only part of the data will be saved • If shorter: run-time error!(saving beyond range) => Change the source code and recompile! • What if the data formats(different floating point number processor) are different? • getc( ) will mis-interpret data.

  13. (b2): ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<sizeof(float); j++) getc(x[i+j], tape); (b1): ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<sizeof(float); j++) putc(x[i+j], tape); ….. • Any problem with (b)? • Program portable? • With respect to data length? • With respect to data format? • Data portable?

  14. (c1): … • float x[N]; • … • for (i=0; i<N; i++) • fprintf(tape,”%f”,x[i]); • ….. (c1): … • float x[N]; • … • for (i=0; i<N; i++) fscanf(fromTape, “%f”,x[i]);

  15. Porting for different languages/culture customs (a): …… printf(“Date: %d/%d/%d”, m, d, yr+2000) …… (b): …… #define LANG x …… { char date[8]; … set_date(date,m,d,yr+2000); printf(“date: %s”, date); … } set_date(date,month,day,year) char *date; int month, day, year; { switch( LANG) { case USA: <encode date as “month/day/year”>; break; case GERMANY: <encode date as “day.month.year”>; break; …. }; return; } not quite portable => internationalization

  16. Portability • Writing one piece of software which can be used in different environment without the need to change the source code • Hardware • Operating systems • Language environment

More Related