Localisation/sv: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 21: Line 21:
=== Översätta med Qt-Linguist (det gamla sättet) ===
=== Översätta med Qt-Linguist (det gamla sättet) ===


{| class="mw-collapsible mw-collapsed wikitable"
Följande information behöver inte användas längre och kommer troligen att bli föråldrad. Det behålls här så att programmerare kan studera hur det fungerar.
|The following information doesn't need to be used anymore and will likely become obsolete.

It is being kept here so that programmers may familiarize themselves with how it works.
* Öppna alla FreeCADs språkmappar som visas nedan
|-
* Verifiera att en .ts fil med din språkkod inte finns ("fr" för franska, "de" för tyska, "se" för svenska, etc...)
|
* Om den finns, så kan du ladda ned den filen, om du vill ändra/granska/förbättra översättningen (klicka på filen, ladda sedan ned)
* Open all of the language folders of FreeCAD shown below
* Om den inte finns, ladda ned den .ts fil utan språkkod (eller någon annan .ts med språkkod, kommer också att fungera)
* Verify that a .ts file with your language code doesn't exist ("fr" for french, "de" for german, etc...)
* Döp om filen med din språkkod
* If it exists, you can download that file, if you want to modify/review/better the translation (click the file, then download)
* Öppna den med Qt-Linguist programmet
* If it doesn't exist, download the .ts file without language code (or any other .ts available, it will work too)
* Börja översätt (Qt Linguist är mycket lättanvänt)
* Rename that file with your language code
* När du är klar, spara din fil
* Open it with the Qt-Linguist program
* [http://www.freecadweb.org/tracker/main_page.php skicka filerna till oss] så vi kan inkludera dem i FreeCADs källkod så andra får glädje av dem.
* Start translating (Qt Linguist is very easy to use)

* Once it's completely done, save your file
=== Tillgängliga översättningsfiler ===
* [http://www.freecadweb.org/tracker/main_page.php send the files to us] so we can include them in the freecad source code so they benefit other users too.<br />

''' Available translation files '''<br />
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Gui/Language/ FreeCAD main GUI]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Gui/Language/ FreeCAD main GUI]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Complete/Gui/Resources/translations/ Complete Workbench]
* [http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Complete/Gui/Resources/translations/ Complete Workbench]
Line 160: Line 161:




Om du är osäker hur du ska fortsätta, tveka inte att be om hjälp på [http://forum.freecadweb.org/ forumet].
If you are unsure how to proceed, don't hesitate to ask for help in the [http://forum.freecadweb.org forum].


===Old translation instructions===
===Old translation instructions===
Line 168: Line 169:
|-
|-
|
|
So the first step is to '''check if the manual translation has already been started for your language''' (look in the left sidebar, under "manual").<br />

If not, head to the [http://forum.freecadweb.org/ forum] and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.<br />
So the first step is to '''check if the manual translation has already been started for your language''' (look in the left sidebar, under "manual").
You must then [[FAQ#How_can_I_get_edit_permission_on_the_wiki.3F|gain wiki edit permission]].<br />

If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: '''go into a red page, and copy/paste the contents of the corresponding English page, and start translating'''.<br />
If not, head to the [http://forum.freecadweb.org/ forum] and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use '''a slash and your language code''' in almost all the links. Look at other already translated pages to see how they did it.<br />

Add a slash and your language code in the categories, like <nowiki>[[Category:Developer Documentation/fr]]</nowiki> <br />
You must then [[FAQ#How_can_I_get_edit_permission_on_the_wiki.3F|gain wiki edit permission]].
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.<br />

If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: '''go into a red page, and copy/paste the contents of the corresponding English page, and start translating'''.

Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use '''a slash and your language code''' in almost all the links. Look at other already translated pages to see how they did it.

Add a slash and your language code in the categories, like <nowiki>[[Category:Developer Documentation/fr]]</nowiki>

And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.

Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)
* [[Template:GuiCommand]] : is the Gui Command information block in upper-right of command documentation.
* [[Template:GuiCommand]] : is the Gui Command information block in upper-right of command documentation.
* [[Template:Docnav]] : it is the navigation bar at the bottom of the pages, showing previous and next pages.
* [[Template:Docnav]] : it is the navigation bar at the bottom of the pages, showing previous and next pages.
''' Page Naming Convention '''<br />

Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.<br />
=== Hur man namnger sidor ===
If you want the Docnav template to show linked pages in your language, you can use '''redirect pages'''. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.<br />

* The page About FreeCAD/fr is the page with content
Notera att beroende på begränsningar i Sourceforges implementering av MediaWiki motorn, så kräver vi att dina sidor ska behålla sina engelska originalnamn, du ska bara lägga till ett snedstreck och din språkkod. Till exempel: Den översatta sidan för About FreeCAD ska ha namnet About Freecad/es för Spanska, About FreeCAD/pl för polska, etc. Skälet är enkelt: om översättare försvinner/slutar översätta, så kan wikins administratörer, vilka inte kan prata alla språk, veta vad dessa sidor är till för. Detta möjliggör underhåll och undviker borttappade sidor.
* The page À propos de FreeCAD contains this code:

Om du vill att Docnav mallen ska visa länkade sidor på ditt språk, så kan du använda '''omdirigeringssidor'''. De fungerar bara som länkar till den egentliga sidan. Här är ett exempel på den franska sidan för About FreeCAD.

* Sidan About FreeCAD/fr är sidan med innehållet
* Sidan À propos de FreeCAD innehåller denna kod:
#REDIRECT <nowiki>[[About FreeCAD/fr]]</nowiki>
#REDIRECT <nowiki>[[About FreeCAD/fr]]</nowiki>
* I About FreeCAD/fr sidan, så kommer Docnav koden att se ut här:
* In the About FreeCAD/fr page, the Docnav code will look like this:
<nowiki>{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}</nowiki>
<nowiki>{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}</nowiki>
Sidan "Bienvenue sur l'aide en ligne" omdirigerar till Online Help Startpage/fr, och sidan "Fonctionnalités" omdirigerar till Feature list/fr.
The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.
|}


{{docnav/sv|Branding/sv|Extra python modules/sv}}
{{docnav/sv|Branding/sv|Extra python modules/sv}}

Revision as of 18:31, 24 March 2015

Lokalisering är i allmänhet den process som ger användargränssnittet i ett program flera språk. I FreeCAD så kan du ställa in användargränssnittets språk under Redigera?Alternativ?Allmänt. FreeCAD använder [Qt] för att aktivera flerspråkssupport. På Unix/Linux system så använder FreeCAD som standard de gällande locale-inställningarna för systemet.

Hjälpa till med att översätta FreeCAD

En av de mycket viktiga saker du kan göra för FreeCAD, om du inte är en programmerare, är att hjälpa till att översätta programmet till ditt språk. Det är nu lättare än någonsin att göra det då vi nu använder oss av Crowdin online översättningssystemet där man kan samarbeta med flera personer

Hur man översätter

  • Gå till FreeCADs projektsida för översättning på Crowdin;
  • Logga in genom att skapa en ny profil, eller genom att använda ett tredjepartskonto som t.ex din Gmail adress;
  • Klicka på det språk som du vill översätta;
  • Börja översätt genom att klicka på Translate knappen intill en av filerna. FreeCAD.ts innehåller till exempel textsträngarna för FreeCADs huvudgränssnitt.
  • Du kan rösta på existerande översättningar, eller så kan du skapa dina egna.
 Notera: Om du deltar aktivt i översättningen av FreeCAD och vill bli  
informerad innan nästa utgåva är klar att släppas, 
so du får tid att granska din översättning, så prenumerera på  
denna punkt: http://www.freecadweb.org/tracker/view.php?id=137


Översätta med Qt-Linguist (det gamla sättet)

The following information doesn't need to be used anymore and will likely become obsolete.

It is being kept here so that programmers may familiarize themselves with how it works.

  • Open all of the language folders of FreeCAD shown below
  • Verify that a .ts file with your language code doesn't exist ("fr" for french, "de" for german, etc...)
  • If it exists, you can download that file, if you want to modify/review/better the translation (click the file, then download)
  • If it doesn't exist, download the .ts file without language code (or any other .ts available, it will work too)
  • Rename that file with your language code
  • Open it with the Qt-Linguist program
  • Start translating (Qt Linguist is very easy to use)
  • Once it's completely done, save your file
  • send the files to us so we can include them in the freecad source code so they benefit other users too.

Available translation files

Förbereda dina egna moduler/applikationer för översättning

Förkrav

För att lokalisera din applikationsmodul så behöver du de hjälpare som kommer tillsammans med Qt. Du kan ladda ned dem från Trolltech-Webbplatsen, men de finns också i LibPack:

qmake
Genererar projektfiler
lupdate
Extraherar eller uppdaterar originaltexterna i ditt projekt genom att skanna källkoden
Qt-Linguist
Qt-Linguist är mycket enkelt att använda och hjälper dig att översätta med fina egenskaper som en frasbok för vanliga ord/meningar.

Inställning av Projekt

För att påbörja lokaliseringen av ditt projekt, gå till GUI-delen av din modul och skriv följande på kommandoraden:

qmake -project

Detta skannar din projektkatalog efter filer som innehåller textsträngar och skapar en projektfil som i följande exempel:

 ######################################################################
 # Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006
 ######################################################################
 
 TEMPLATE = app
 DEPENDPATH += .\Icons
 INCLUDEPATH += .
 
 # Input
 HEADERS += ViewProvider.h Workbench.h
 SOURCES += AppMyModGui.cpp \
            Command.cpp \
            ViewProvider.cpp \
            Workbench.cpp
 TRANSLATIONS += MyMod_de.ts

Du kan lägga till filer manuellt här. Avsnittet TRANSLATIONS innehåller en lista med filer med översättningen för varje språk. I ovanstående exempel så är MyMod_de.ts den tyska översättningen.

Nu behöver du köra lupdate för att plocka ut alla textsträngar i ditt gränssnitt. Genmóm att köra lupdate efter ändringar i källkoden är alltid säkert eftersom den aldrig raderar strängar från dina översättningsfiler. Den lägger endast till nya strängar.

Nu behöver du lägga till .ts-filerna till ditt VisualStudio projekt. Specificera följande anpassade byggmetod för dem:

python ..\..\..\Tools\qembed.py "$(InputDir)\$(InputName).ts"
                 "$(InputDir)\$(InputName).h" "$(InputName)"

Notera: skriv detta i en enda kommandorad, radbrytningen är endast för utseendet här.

Genom att kompilera .ts-filen i ovanstående exempel, så skapas headerfilen MyMod_de.h . Bästa platsen att inkludera denna är i App<Modul>Gui.cpp. I vårt exempel så skulle det vara AppMyModGui.cpp. Där lägger du till raden

new Gui::LanguageProducer("Deutsch", <Modul>_de_h_data, <Modul>_de_h_len);

för att publicera din översättning i applikationen.

Ställa in pythonfiler för översättning

För att förenkla lokalisering av py filer så kan du använda verktyget "pylupdate4" vilket accepterar en eller fler py filer. Med alternativet -ts så kan du förbereda/uppdatera en eller fler .ts filer. För att till exempel förbereda en .ts fil för Franska, skriv i kommandoraden:

pylupdate4 *.py -ts YourModule_fr.ts 

pylupdate verktyget kommer att skanna dina .py filer för translate() eller tr() funktioner och skapa en YourModule_fr.ts fil. Den filen kan sedan översättas med Qt-Linguist och en YourModule_fr.qm fil producerad från Qt-Linguist eller mad kommandot

lrelease YourModule_fr.ts

Var uppmärksam på att verktyget pylupdate4 inte är speciellt bra på att känna igen translate() funktioner, de måste formatteras mycket specifikt ( se Ritmodul filerna för exempel). Inuti din fil, så kan du ställa in en översättare som denna (efter att du har laddat din QApplication men INNAN du skapar några qt widgetar):

translator = QtCore.QTranslator()
translator.load("YourModule_"+languages[ln])
QtGui.QApplication.installTranslator(translator)

Alternativt, så kan du även skapa filen XML Draft.qrc med detta innehåll:

  
<RCC>
<qresource prefix="/translations" > 
<file>Draft_fr.qm</file> 
</qresource> 
</RCC> 

och genom att köra pyrcc4 Draft.qrc -o qrc_Draft.py så skapas en stor Python som innehåller alla resurser. Detta sätt fungerar också för att lägga alla ikonfiler i en resursfil

Översätta wikin

This wiki is hosting a lot of contents, the majority of which build up the manual. You can browse the documentation starting from the Main Page, or have a look at the User's manual Online Help Toc.

Translation plugin

When the Wiki moved away from SourceForge, Yorik installed a Translation plugin which allows to ease translations between pages. For example, the page title can now be translated. Other advantages of the Translation plugin are that it keeps track of translations, notifies if the original page has been updated, and maintains translations in sync with the original English page.

The tool is documented in Extension:Translate, and is part of a Language Extension Bundle.

To quickly get started on preparing a page for translation and activating the plugin, please read the Page translation example.

To see an example of how the Translation tool works once the translation plugin is activated on a page, you can visit the Main Page. You will see a new language menu bar at the bottom. It is automatically generated. Click for instance on the German link, it will get you to Main Page/de. Right under the title, you can read "This page is a translated version of a page Main Page and the translation is xx% complete." (xx being the actual percentage of translation). Click on the "translated version" link to start translation, or to update or correct the existing translation.

You will notice that you cannot directly edit a page anymore once it's been marked as a translation. You have to go through the translation utility.

When adding new content, the English page should be created first, then translated into another language. If someone wants to change/add content in a page, he should do the English one first.

It is recommended to have basic knowledge of wiki style formatting and general guidelines of the FreeCAD wiki, because you will have to deal with some tags while translating. You can find this information on WikiPages.

The sidebar (navigation menu on the left) is also translatable. Please follow dedicated instructions on Localisation Sidebar page.

REMARK: The first time you switch a page to the new translation system, it looses all its old 'manual' translations. To recover the translation, you need to open an earlier version from the history, and copy/paste manually the paragraphs to the new translation system.

Remark: to be able to translate in the wiki, you must of course gain wiki edit permission.


If you are unsure how to proceed, don't hesitate to ask for help in the forum.

Old translation instructions

These instructions are for historical background only, while the pages are being passed to the new translation plugin.

So the first step is to check if the manual translation has already been started for your language (look in the left sidebar, under "manual").
If not, head to the forum and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.
You must then gain wiki edit permission.
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: go into a red page, and copy/paste the contents of the corresponding English page, and start translating.
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use a slash and your language code in almost all the links. Look at other already translated pages to see how they did it.
Add a slash and your language code in the categories, like [[Category:Developer Documentation/fr]]
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)

  • Template:GuiCommand : is the Gui Command information block in upper-right of command documentation.
  • Template:Docnav : it is the navigation bar at the bottom of the pages, showing previous and next pages.

Page Naming Convention
Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.
If you want the Docnav template to show linked pages in your language, you can use redirect pages. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.

  • The page About FreeCAD/fr is the page with content
  • The page À propos de FreeCAD contains this code:
#REDIRECT [[About FreeCAD/fr]]
  • In the About FreeCAD/fr page, the Docnav code will look like this:
{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}

The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.

Branding/sv
Extra python modules/sv