Modify

Opened 4 years ago

Closed 3 years ago

#2183 closed enhancement (fixed)

Optimize i18n to save space

Reported by: stoecker Owned by: framm
Priority: minor 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 Changed 4 years ago by xeen

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 Changed 4 years ago by stoecker

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 Changed 3 years ago by stoecker

Fixed in r2754.

comment:4 Changed 3 years ago by Gubaer

  • Resolution set to fixed
  • Status changed from new to closed

Seems to be fixed. Closing.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.