Improve documentation around localization / languages
#1
I just converted my ancient plugin from using strings.xml to strings.po, and I got pretty darn confused.

* http://kodi.wiki/view/language_support says to put the files at resources/language/resource.language_$code/strings.po, but every addon I've looked at in the master repo has resources/language/$language/strings.po
* The syntax of the file seems totally mad and this merits explanation msg*id* = the text, msgctxt (message comment text?) = the id, msgtxt = empty string. What on earth happened?
* Translated examples I've seen look something like this:

msgctxt "30000"
msgid "Text in English"
msgstr "Text in die Auslaendische Sprache"

Why do we replicate the English text across every translation in msgid? Is this is supposed to be an id in any meaningful way? If it is, what happens if the word is the same in English but not other languages, e.g. (cricket) bat vs (animal/man) bat?

* Perhaps I'm the only addon who was still using strings.xml but a conversion script would have been useful:

Code:
code deleted as it was broken :(
Reply
#2
(2017-01-14, 01:43)moreginger Wrote: * http://kodi.wiki/view/language_support says to put the files at resources/language/resource.language_$code/strings.po, but every addon I've looked at in the master repo has resources/language/$language/strings.po
the wiki is correct, this is the current naming standard we use.
most addons in the repo still use the previous standard, which we obviously still support for backward compatibility reasons.

(2017-01-14, 01:43)moreginger Wrote: * The syntax of the file seems totally mad and this merits explanation msg*id* = the text, msgctxt (message comment text?) = the id, msgtxt = empty string. What on earth happened?
in case you're interested in reading up on it:
https://www.gnu.org/savannah-checkouts/g...Files.html

(2017-01-14, 01:43)moreginger Wrote: Perhaps I'm the only addon who was still using strings.xml but a conversion script would have been useful
there is one, our transifex system handles conversion from .xml to .po: http://forum.kodi.tv/showthread.php?tid=142736
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
I thought I had read somewhere the string Id range was no longer required?
Reply
#4
(2017-01-14, 03:18)ronie Wrote: the wiki is correct, this is the current naming standard we use.
most addons in the repo still use the previous standard, which we obviously still support for backward compatibility reasons.

Is there a drop dead date yet for changing to the new standard? Also, is there a mapping somewhere of the old folder names to the new one? I'd kind of rather not do them all by hand if I can help it.
Reply
#5
Thanks for the reply and links. I've requested Wiki editing access and I'll see if I can update this page a bit.

(2017-01-14, 03:18)ronie Wrote: in case you're interested in reading up on it:
https://www.gnu.org/savannah-checkouts/g...Files.html
I had a look, but this is exactly what I didn't want to do over the last few days when I was just trying to get my plugin into the new repos.

I don't know how it is used in other projects but my sense is that setting msgid to an id - rather than an original language string with a nonoptional disambiguating context which is actually what Kodi uses as an id - would make more sense. I'd suggest that we change the example to:

msgctxt "30000"
msgid "30000"
msgstr "La text"

Or possibly:

msgctxt "30000"
msgid "Doesn't matter so long as it's the same for each translation of this message and perhaps Transifex will overwrite this anyway?"
msgstr "La text"

(2017-01-14, 03:18)ronie Wrote: there is one, our transifex system handles conversion from .xml to .po: http://forum.kodi.tv/showthread.php?tid=142736
Ah, since that post is 1) 4 years old and 2) asks you to email the defunct mailing list, I wasn't sure how much to rely on it Smile
Reply
#6
(2017-01-14, 07:37)pkscout Wrote:
(2017-01-14, 03:18)ronie Wrote: the wiki is correct, this is the current naming standard we use.
most addons in the repo still use the previous standard, which we obviously still support for backward compatibility reasons.

Is there a drop dead date yet for changing to the new standard? Also, is there a mapping somewhere of the old folder names to the new one? I'd kind of rather not do them all by hand if I can help it.
Nope no date set at all.

They're based of ISO codes so you could potentially follow https://github.com/xbmc/repo-resources/tree/krypton
iirc there is indeed a tool for converting but not sure to what extend it already got updated by @alanwww1
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#7
(2017-01-14, 17:37)moreginger Wrote: Thanks for the reply and links. I've requested Wiki editing access and I'll see if I can update this page a bit.
great, much appreciated!
i've confirmed your account request.

(2017-01-14, 17:37)moreginger Wrote: Ah, since that post is 1) 4 years old and 2) asks you to email the defunct mailing list, I wasn't sure how much to rely on it Smile
i'm afraid you're right. it's more like a used to be thing... perhaps we can get transifex back on track one day.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#8
Maybe we can start the same method as with addon submission and use github tickets for requesting transifex inclusion? Either in the plugins/scripts repo or the translation repo
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#9
(2017-01-15, 15:56)ronie Wrote:
(2017-01-14, 17:37)moreginger Wrote: Thanks for the reply and links. I've requested Wiki editing access and I'll see if I can update this page a bit.
great, much appreciated!
i've confirmed your account request.

(2017-01-14, 17:37)moreginger Wrote: Ah, since that post is 1) 4 years old and 2) asks you to email the defunct mailing list, I wasn't sure how much to rely on it Smile
i'm afraid you're right. it's more like a used to be thing... perhaps we can get transifex back on track one day.

So i tried this but kept getting errors basically stating the string didnt exist. So i added the old /English/strings.po back and the errors went away.
I then added the new structure and update the old strings.po, but the changes did not show. I updated the new strings.po and it worked.

So to me it appears you still need the /English/strings.po and the resource.language.en_us/strings.po in order to use this structure.

Is this a bug, or was i misunderstanding ?
Reply
#10
the default language file is en_gb, not en_us.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#11
(2017-01-17, 01:38)ronie Wrote: the default language file is en_gb, not en_us.

Got it, works fine now. I thought it defaulted to the only existing one if you only had one language.
Thanks for the clarification.
Reply
#12
(2017-01-17, 01:38)ronie Wrote: the default language file is en_gb, not en_us.
Yes, so "English" = "en_gb" and it's the default.

Also, it appears that it reads the string from "msgid" from that file as opposed to all the "translations" which read it from "msgtxt".

Confusing, but I think I almost understand it. I've got English, Portuguese and Finnish working, but Hungarian (hu_HU) and Swedish (sv_SE) are still causing me problems. OK sorted them now, phew!
Reply

Logout Mark Read Team Forum Stats Members Help
Improve documentation around localization / languages0