/usr/share/lua/5.1/tongue/util.lua is in lua-tongue 0.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | -- lib/tongue/util.lua
--
-- Lua I18N library 'Tongue' - Utility routines
--
-- Copyright 2016 Daniel Silverstone <dsilvers@digital-scurf.org>
--
-- For licence terms, see COPYING
--
--- Tongue needs to process lots of interesting data, here are some utility
-- functions it might use.
--
-- @module tongue.util
--- Split a category into its components.
--
-- Categories can have low level languages, sub languages (countries), and
-- character sets. This routine splits a category string in the same way as
-- glibc does which seems to be a reasonable 'standard' to use.
--
-- @tparam string category The category to split up
-- @treturn string The base (low level) language name.
-- @treturn ?string The sub-language (or nil if no sub-language was specified)
-- @treturn ?string The characterset (or nil if no character set was specified)
-- @function split_category
local function split_category(category)
-- ll_CC.SSS
local charset = nil
if category:find("%.") then
category, charset = category:match("^(.-)%.(.+)$")
end
local country = nil
if category:find("_") then
category, country = category:match("^(.-)_(.+)$")
end
return category, country, charset
end
return {
split_category = split_category,
}
|