Hello Adel

Adel Atallah píše v Pá 20. 04. 2018 v 10:07 +0200:
> 
> So I wanted to know: can we create and add a custom file format in
> Weblate?

Yes. With Weblate 2.x it was not really straightforward (it required
patching Weblate files), but in Weblate 3.x it will work by just adding
another class name to the WEBLATE_FILE_FORMATS setting.

> FYI, our first file format is only a Java properties file but with
> some specificities. It has an obsolete section (containing old keys
> and values) in the base file, which should be ignored by the
> translation platform. I tried to create a component to translate this
> type of file, it worked well but I had a problem. The base file is
> named for example "ApplicationResources.properties", and this is not
> what Weblate would expect. This file is translated into English by
> default and the "ApplicationResources_en.properties" file is always
> empty. This means that Weblate cannot use our base translation
> files. 

You can configure Weblate to use ApplicationResources.properties as
base and ignore en language by the language regexp, that should work.

> The second file format is an XML file. There are two elements to
> translate, the content of the "title" tag and the content of the
> "content" tag, and we should also be able to add other data, such as
> the local property of the root node. The best solution I can think of
> is to create a tool to convert this XML type into another standard
> translation file type and then simply import them into Weblate (and
> redo an XML conversion afterwards), but maybe someone has a better
> idea.

Somebody is already working on customizable XML format, that might work
for you as well, see pull request for translate-toolkit:

https://github.com/translate/translate/pull/3776


-- 
        Michal Čihař | https://cihar.com/ | https://weblate.org/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Weblate mailing list
[email protected]
https://lists.cihar.com/cgi-bin/mailman/listinfo/weblate

Reply via email to