def printLocaleDeclarations(self, outWriter):
        """Prints the queued (pending) locale definitions to a PrintWriter
        in a (UIDL) format that can be sent to the client and used there in
        formatting dates, times etc.
        """
        # Send locale informations to client
        outWriter.write(', \"locales\":[')

        while self._pendingLocalesIndex < len(self._locales):
            l = self.generateLocale(self._locales[self._pendingLocalesIndex])

            # Locale name
            outWriter.write('{\"name\":\"' + str(l) + '\",')

            # Month names (both short and full)
            months = l.months['format']['wide'].values()
            short_months = l.months['format']['abbreviated'].values()

            outWriter.write(('\"smn\":[\"'
                    + short_months[0] + '\",\"' + short_months[1] + '\",\"'
                    + short_months[2] + '\",\"' + short_months[3] + '\",\"'
                    + short_months[4] + '\",\"' + short_months[5] + '\",\"'
                    + short_months[6] + '\",\"' + short_months[7] + '\",\"'
                    + short_months[8] + '\",\"' + short_months[9] + '\",\"'
                    + short_months[10] + '\",\"' + short_months[11] + '\"'
                    + '],').encode('utf-8'))
            outWriter.write(('\"mn\":[\"'
                    + months[0] + '\",\"' + months[1] + '\",\"'
                    + months[2] + '\",\"' + months[3] + '\",\"'
                    + months[4] + '\",\"' + months[5] + '\",\"'
                    + months[6] + '\",\"' + months[7] + '\",\"'
                    + months[8] + '\",\"' + months[9] + '\",\"'
                    + months[10] + '\",\"' + months[11] + '\"'
                    + '],').encode('utf-8'))

            # Weekday names (both short and full)
            days = l.days['format']['wide'].values()
            short_days = l.days['format']['abbreviated'].values()
            outWriter.write(('\"sdn\":[\"'
                    + short_days[6] + '\",\"'
                    + short_days[0] + '\",\"' + short_days[1] + '\",\"'
                    + short_days[2] + '\",\"' + short_days[3] + '\",\"'
                    + short_days[4] + '\",\"' + short_days[5] + '\"'
                    + '],').encode('utf-8'))
            outWriter.write(('\"dn\":[\"'
                    + days[6] + '\",\"'
                    + days[0] + '\",\"' + days[1] + '\",\"'
                    + days[2] + '\",\"' + days[3] + '\",\"'
                    + days[4] + '\",\"' + days[5] + '\"'
                    + '],').encode('utf-8'))

            # First day of week
            # (Babel: 6 = sunday, 0 = monday, Vaadin: 0 = sunday, 1 = monday)
            fdow = l.first_week_day
            if fdow == 0:
                fdow = 1
            else:
                fdow = 0
            outWriter.write('\"fdow\":' + str(fdow) + ',')

            # Date formatting (MM/DD/YYYY etc.)
            try:
                df = l.date_formats['short'].pattern
                df += ' '
                df += l.time_formats['short'].pattern
                df = df.encode('utf-8')  # convert unicode to string
            except __HOLE__:
                logger.warning('Unable to get default date '
                               'pattern for locale ' + str(l))
                #df = locale.nl_langinfo(locale.D_T_FMT)
                df = 'dd/MM/yy HH:mm'

            timeStart = df.find('H')
            if timeStart < 0:
                timeStart = df.find('h')
            ampm_first = df.find('a')
            # E.g. in Korean locale AM/PM is before h:mm
            # TODO should take that into consideration on client-side as well,
            # now always h:mm a
            if ampm_first > 0 and ampm_first < timeStart:
                timeStart = ampm_first
            # Hebrew locale has time before the date
            timeFirst = timeStart == 0
            if timeFirst:
                dateStart = df.find(' ')
                if ampm_first > dateStart:
                    dateStart = df.find(' ', ampm_first)
                dateformat = df[dateStart + 1:]
            else:
                dateformat = df[:timeStart - 1]

            outWriter.write('\"df\":\"' + dateformat.strip() + '\",')

            # Time formatting (24 or 12 hour clock and AM/PM suffixes)
            timeformat = df[timeStart:len(df)]

            # Doesn't return second or milliseconds.
            #
            # We use timeformat to determine 12/24-hour clock
            twelve_hour_clock = timeformat.find('a') > -1

            # TODO there are other possibilities as well, like 'h' in french
            # (ignore them, too complicated)
            hour_min_delimiter = '.' if timeformat.find('.') > -1 else ':'

            # outWriter.write("\"tf\":\"" + timeformat + "\",");
            outWriter.write('\"thc\":' + str(twelve_hour_clock).lower() + ',')
            outWriter.write('\"hmd\":\"' + hour_min_delimiter + '\"')
            if twelve_hour_clock:
                ampm = [( l.periods['am'] ).encode('utf-8'),
                        ( l.periods['pm'] ).encode('utf-8')]
                outWriter.write(',\"ampm\":[\"' + ampm[0] + '\",\"'
                                + ampm[1] + '\"]')
            outWriter.write('}')
            if self._pendingLocalesIndex < len(self._locales) - 1:
                outWriter.write(',')

            self._pendingLocalesIndex += 1

        outWriter.write(']')  # close locales
dataset/ETHPy150Open rwl/muntjac/muntjac/terminal/gwt/server/abstract_communication_manager.py/AbstractCommunicationManager.printLocaleDeclarations