Follow-up Comment #2, bug #48481 (project gettext): My code build alternative IDs looking for these chars: '.', '_', '-', '@'. So, if locale is "foo@bar@baz", we have this list of IDs: - "foo@bar@baz" - "foo@bar" - "foo"
Instead of storing copies of the string, I save the position of the stop chars. In the above case, we'll have these values: - locale_lengths_count = 3 - locale_lengths[0] = 11 - locale_lengths[1] = 7 - locale_lengths[2] = 3 When looking for the plural rule, the code compares the IDs using each of these locale_lengths using xmlStrncmp and stops at the first match. So, if someone specify "en@us", the code won't convert it to "en-us", but simply looks for "en@us" and "en". _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?48481> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/