Files
freeipa/ipalib/plugins/internal.py
T
Adam Young c187702bfe I18N for web
Performing I18N completely on the server, to leverage the
existing gettext architecture.
Also, the browser does not have access to the Language header.

Added the additional po files for a set of required languages

conflict with install/static/ipa.js was resolved.

Note that the addition of the .po files in this patch is necessary.
In order to get Transifex support, we need to update the LINGUAS
file with the languages for which we want support.  If we don't
add the .po files in, they get automatically generated by the rpmbuild
process.  Our implementation of gettext has a bug in it (It might
be F13 thing) where the the Plurals line is not getting correctly
transformed, which causes a build failure.  However, since the
RPM would have the .po files  anyway, we should revision control
the ones we have, even if they are empty.

Fixed the Bug reporting url to the original value.
Corrected the Chartype encoding for UK
2010-09-27 13:30:55 -04:00

90 lines
2.7 KiB
Python

# Authors:
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (c) 2010 Red Hat
# See file 'copying' for use and warranty information
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the gnu general public license as
# published by the free software foundation; version 2 only
#
# This program is distributed in the hope that it will be useful,
# but without any warranty; without even the implied warranty of
# merchantability or fitness for a particular purpose. See the
# gnu general public license for more details.
#
# You should have received a copy of the gnu general public license
# along with this program; if not, write to the Free Software
# Foundation, inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
Plugins not accessible directly through the CLI, commands used internally
"""
import json
from ipalib import api, errors
from ipalib import Command
from ipalib import Str
from ipalib.output import Output
from ipalib.text import _
from ipalib.util import json_serialize
class json_metadata(Command):
"""
Export plugin meta-data for the webUI.
"""
INTERNAL = False
messages={
"login": {"header" :_("Logged In As")},
"button":{
"add":_("Add"),
"find": _("Find"),
"reset":_("Reset"),
"update":_("Update"),
"enroll":_("Enroll")
},
"search":{
"quick_links":_("Quick Links")
},
"details":{
"identity":_("Identity Details"),
"account":_("Account Details"),
"contact":_("Contact Details"),
"mailing":_("Mailing Address"),
"employee":_(" Employee Information"),
"misc":_("Misc. Information"),
"to_top":_("Back to Top")}
}
takes_args = (
Str('objname?',
doc=_('Name of object to export'),
),
)
has_output = (
Output('metadata', dict, doc=_('Dict of JSON encoded IPA Objects')),
Output('messages', dict, doc=_('Dict of I18N messages')),
)
def execute(self, objname):
if objname and objname in self.api.Object:
return dict(
result=dict(
((objname, json_serialize(self.api.Object[objname])), )
)
)
result=dict(
(o.name, json_serialize(o)) for o in self.api.Object()
)
retval= dict([("metadata",result),("messages",json_serialize(self.messages))])
return retval
def output_for_cli(self, textui, result, *args, **options):
print json.dumps(result, default=json_serialize)
api.register(json_metadata)