Modify

Opened 15 years ago

Closed 14 years ago

#2183 closed enhancement (fixed)

Optimize i18n to save space

Reported by: stoecker Owned by: framm
Priority: minor Milestone:
Component: Core Version:
Keywords: Cc:

Description

Currently we use the gettext functions to have i18n. Each language copies all english strings which is a terrible waste of space. We have 21 copies of each string. This could be reduced to 2.

As we anyway have a wrapper we can change it like that:

  • store English strings in a hash containing a array index as value
  • store i18n strings in arrays
  • on tr() parse get the array index from hash and get string from array with the index

Problem: How to handle plural forms?

Attachments (0)

Change History (4)

comment:1 by xeen, 15 years ago

Plural Forms: I suggest implementing the same method that is used by Firefox:
https://developer.mozilla.org/en/Localization_and_Plurals

(I followed development at that time and it took quite a while until the devs found something suitable that works for all languages, see https://bugzilla.mozilla.org/show_bug.cgi?id=394516 ).

comment:2 by stoecker, 15 years ago

gettext already has a system (using a numeric syntax to define the forms I believe). The question is how we should handle that when we replace gettext:

  • use gettext for plurals also in future
  • copy gettext plural stuff into josm
  • reimplement it
  • something else

Above described hash/array method works as is only for non-plurals.

comment:3 by stoecker, 14 years ago

Fixed in r2754.

comment:4 by Gubaer, 14 years ago

Resolution: fixed
Status: newclosed

Seems to be fixed. Closing.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framm.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.