MozillaZine

Localite 0.1.0 - Localisation extension

Talk about add-ons and extension development.
lid2000

User avatar
 
Posts: 174
Joined: April 6th, 2004, 11:49 pm
Location: Australia

Post Posted May 6th, 2005, 8:28 am

I'm sick of having to write/paste billions of !ENTITY tags, and having people offer to localise my extension but get scared when I try to talk them through unicode/escaping and what a DTD is, etc. So I'm thinking of making an extension that lets you edit DTDs and .properties files with an interface similar to how about:config looks. You could maybe load a whole directory of files up in tabs, then work your way through. It'd create !ENTITY tags and set the right values, and save as UTF-8 for DTDs, and would encodeURIComponent() all .properties input. Hopefully making this simple to use would encourage more people to help with localisation and stuff.

Anyway, the question is: Has this been done before? I haven't researched or anything, this is just off the top of my head.
Last edited by lid2000 on June 7th, 2005, 3:57 am, edited 2 times in total.

cyberrus

User avatar
 
Posts: 144
Joined: October 15th, 2004, 5:42 pm
Location: Wroclaw, Poland

Post Posted May 6th, 2005, 1:24 pm

this is sth new - i havent heard about sth like this - it's cool idea

/\/\axx
 
Posts: 78
Joined: July 16th, 2004, 1:01 pm

Post Posted May 7th, 2005, 8:41 am

phplangeditor - The Extensions Mirror might be useful in creating your extension.
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5 - Installed Extensions

Mook
 
Posts: 1752
Joined: November 7th, 2002, 9:35 pm

Post Posted May 7th, 2005, 11:28 am

See also stuff like mozlcdb, perhaps? (Well, that needs perl, so maybe you would need to send the text files over...)
poot.

lid2000

User avatar
 
Posts: 174
Joined: April 6th, 2004, 11:49 pm
Location: Australia

Post Posted May 12th, 2005, 5:25 am

Okay, I've been sticking one together, at the moment it looks like this:

Image

You select a directory that contains all the .dtd and .properties files, then it goes through them all and loads them (properly unescaping the unicode in .properties files and everything) into the tree at the top. Then you select an entity from the tree, and it'll load the text of it up in the textbox. Change it how you want ("Original text" is kept on the screen for reference), hit save/next/whatever, and it saves it in the file it was from, along with the proper encoding/escaping. It doesn't work 100% yet so I haven't put it online, but I'm asking, from what you can see in the UI, what needs improving? Translation is a tedious job, so I want to make it as easy and fast as possible to get it done. So if anyone has any ideas, it'd be great.

xavivars
 
Posts: 25
Joined: May 15th, 2004, 6:07 am

Post Posted May 12th, 2005, 1:19 pm

Hi!

First of all, tell you that it is a very good idea.

What would be great is to be able to merge an old translated dtd with the new untranslated one, so if you release a new version of your extension, then I can, using the old translated dtd, translate the new one easily.

What do you think?

(Ali)
 
Posts: 67
Joined: April 23rd, 2005, 5:35 pm
Location: Saudi Arabia

Post Posted May 12th, 2005, 5:16 pm

lid2000 ...

this would be great...
Excellent

jedbro

User avatar
 
Posts: 1899
Joined: November 10th, 2002, 12:35 pm
Location: Mexico / Boulder Co.

Post Posted May 12th, 2005, 5:23 pm

This would be excelent.

I don't personally localize extension, but all my extension are localizable and I'm sure those who do it would find this to be awesome.

Do you have a preview version we could check out? If so, I might be able to contribute some code.

Cheers
-Jed

lid2000

User avatar
 
Posts: 174
Joined: April 6th, 2004, 11:49 pm
Location: Australia

Post Posted June 6th, 2005, 9:45 pm

I'm stuck home with the world's worst flu so I started over on this.

Problems I'm having at the moment are the regexps that are used to split up the <!ENTITY> tags don't seem to work 100% of the time, and I have absolutely no idea why. Also I can't figure out how to make the extension capture that you've pressed 'enter' when the input textbox has focus (was going to have when you pressed 'enter' it did the same as clicking 'Next', but if you press shift+enter it just gives a newline).

Not 100% keen on the UI either, might switch it all around again. Note that this is a half finished product and it only half works. You can download it here (this is not a release), but you'll have to manually install it yourself as I just zipped what I had and put it up, in case anyone out there could solve these two problems (mainly the regexp thing has got me at the moment). Anyway, like I said, very basic, only the result of a few hours work so far.

Now I'm off to stack up on more cold/flu tablets that don't seem to be doing anything.

(make backups of all the files you're editing with it, I can pretty much guarantee it'll hose them at some point)

lid2000

User avatar
 
Posts: 174
Joined: April 6th, 2004, 11:49 pm
Location: Australia

Post Posted June 6th, 2005, 9:57 pm

Forget about the capturing enter problem, I'll just use ctrl+enter instead. Decided to switch back to a UI similar to the screenshot above.

lid2000

User avatar
 
Posts: 174
Joined: April 6th, 2004, 11:49 pm
Location: Australia

Post Posted June 7th, 2005, 3:56 am

Okay, here's my first semi-release of Localite.

Localite 0.1.0

Note that it's still very incomplete, but does a real basic version of what I want it to do (make it a bit easier to edit DTD and properties files for extension translation). If you don't know what this is, then you don't need this extension.

When installed, it should appear in the Tools menu in Firefox, and the Window menu in Mozilla. I think.

Known bugs:
  • Comments inside DTD files get stripped.
  • If there's more than one <!ENTITY> per line, it'll herniate.
  • No "Save" reminders.
  • No error handling whatsoever for saving/loading.
  • Can't close tabs.
  • Can't spellcheck.
  • No option to recursively open directories.
  • Localite itself isn't localisable yet (how ironic).
  • Can't search for stuff.
  • Can't create new entities or new files (although seeing as though the idea of this is soley to translate, not to create, I don't know if I'll add the abillity yet).

That's the major stuff. Other bugs and ideas, can you please stick in this thread?

Be sure to backup any locale files before you start editing them with this!

Gert-Paul
 
Posts: 277
Joined: December 16th, 2003, 6:15 am
Location: the Netherlands

Post Posted June 7th, 2005, 10:42 am

Great extension with potential. If you can solve all bugs above translating extensions would be much easier for people. If would be even simpler if a untranslated extension could be loaded, the terms translated by the user and that a translated could be saved as output. I don't know if that would be possible, but that would make it usable for simply everybody...

Two things I noticed:
- It doesn't work with trunkbuilds. In the JS-console I get this error: Fout: uncaught exception: [Exception... "Could not convert JavaScript argument arg 1 [nsITreeView.getCellText]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: chrome://localite/content/localite.js :: showText :: line 110" data: no] if I select a line.
- The translated text is directlly replaced and there is no way to look to the original text. This could be useful to check your translation.

iacchi
 
Posts: 17
Joined: March 1st, 2005, 10:09 am
Location: Florence, Italy

Post Posted June 7th, 2005, 12:57 pm

I've localized the extension in italian, but I've found a very funny thing: you've written this extension to help us in translating extensons with locale, but actually your extension hasn't got a locale and it's more difficult to translate than an extension with the locale, even without your extension ;)

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 0 guests