""Looks in specific folders in the current application""
On Sun, Mar 11, 2012 at 8:49 AM, Bruce Wade <[email protected]> wrote: > How would we update this method so it also gets all the strings from the > gluon package? When you click update all languages it only looks in the > specific language folders. This should also look in the gluon package and > ideally there should be away to add locations for it to look. > > def findT(path, language='en-us'): > """ > must be run by the admin app > """ > filename = os.path.join(path, 'languages', '%s.py' % language) > sentences = read_dict(filename) > mp = os.path.join(path, 'models') > cp = os.path.join(path, 'controllers') > vp = os.path.join(path, 'views') > for file in listdir(mp, '.+\.py', 0) + listdir(cp, '.+\.py', 0)\ > + listdir(vp, '.+\.html', 0): > fp = portalocker.LockedFile(file, 'r') > data = fp.read() > fp.close() > items = regex_translate.findall(data) > for item in items: > try: > message = eval(item) > if not message.startswith('#') and not '\n' in message: > tokens = message.rsplit('##', 1) > else: > # this allows markmin syntax in translations > tokens = [message] > if len(tokens) == 2: > message = tokens[0].strip() + '##' + tokens[1].strip() > if message and not message in sentences: > sentences[message] = message > except: > pass > write_dict(filename, sentences) > > On Sun, Mar 11, 2012 at 8:39 AM, Bruce Wade <[email protected]> wrote: > >> Okay, >> >> Well maybe it is just me but I think when you click the update >> translations button in admin, it should automatically grab ALL >> strings especially default strings in admin so we can translate them. For >> example with pyramid you use python setup.py extract_messages this will go >> through every single file in the project to pull out the translate able >> strings. >> >> Would it be difficult to change the way translation works to do this? >> >> >> On Sun, Mar 11, 2012 at 5:21 AM, Alan Etkin <[email protected]> wrote: >> >>> When messages object is instantiated, T is passed as argument >>> probabbly to process default auth values for translation. >>> Then .password_reset_button is set without T(...), so for automatic >>> translation, there should be some operator overloading for the Message >>> instance to translate the text without explicit T call, otherwise, the >>> attribute will just be set without further actions. >>> >>> On 11 mar, 01:26, Bruce Wade <[email protected]> wrote: >>> > Hi, >>> > >>> > I was looking at the Auth class, why are settings like the following >>> not >>> > showing in the language translations files by default? >>> > >>> > # ## these are messages that can be customized >>> > messages = self.messages = Messages(current.T) >>> > messages.password_reset_button = 'Request reset password' >>> > >>> > I have no idea what Messages(current.T) is supposed to do however the >>> above >>> > string is not found in the languages files. >>> > >>> > -- >>> > -- >>> > Regards, >>> > Bruce Wadehttp:// >>> ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com >>> >> >> >> >> -- >> -- >> Regards, >> Bruce Wade >> http://ca.linkedin.com/in/brucelwade >> http://www.wadecybertech.com >> http://www.warplydesigned.com >> http://www.fitnessfriendsfinder.com >> > > > > -- > -- > Regards, > Bruce Wade > http://ca.linkedin.com/in/brucelwade > http://www.wadecybertech.com > http://www.warplydesigned.com > http://www.fitnessfriendsfinder.com > -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.warplydesigned.com http://www.fitnessfriendsfinder.com

