[SOLVED] Translation of packages for Luci

I would like to translate some OpenWRT packages into Spanish but I do not know how to do it.

1 Like
1 Like

:+1: :ok_hand::muscle:

How do I translate the packages? There is no proper guide to start.

I already downloaded this https://github.com/openwrt/luci.git and sent this command ./build/i18n-add-language.sh "es" and I already translated some things with the Poedit program.
What do I do now?

"es (spanish)" is already supported in LuCI (here).

So, you can translate by copying pot as po from the template of the package you want to translate and editing it.

example (luci-app-adblock):

copy from:
  root/applications/luci-app-adblock/po/templates/adblock.pot

copy to:
  root/applications/luci-app-adblock/po/es/adblock.po

Note: The name of the po file must be the application name minus the prefix (luci-app-).

For translation, it is convenient to use tools such as poedit.

1 Like

And how do I contribute translations to Luci?

Open the PR in openwrt/luci.

For detailed instructions, you can refer to Contributing Guidelines or merged PR.

I already translated the .po file (ddns to test).
Whats Next?

Please follow the guildeline for LuCI project and make your commit in Git.

git add .
git commit -s
git push origin <branch name>

After that, open a PR in openwrt/luci.

Better first I research how to use GitHub because I'm new to this.

I see, that would be nice.

I try to upload the changes but I put my username wrong How do I correct it?
He says I have permission denied.
I can not login when sending the command git push origin master

What I do?

I already cloned Luci
I edited the .po file
I added the files with git add .
Configure git config --global user.email "email" and git config --global user.name "name"
Add a message in git commit -m "comment"
I send the command git push origin master and it says:

remote: Permission to openwrt / luci.git denied to castillofrancodamian.
fatal: unable to access 'https://github.com/openwrt/luci.git/': The requested URL returned error: 403

You do not have the necessary permission to push to openwrt/luci repository.
So, you need to fork the repository under your GitHub account and make the changes in it, and create a PR (Pull Request) with your repository.

  1. Fork the repository
    Create the copy of openwrt/luci repository under your account. This is called as "fork". Press "Fork" button in the upper right of LuCI repository page.

  2. Clone your fork
    Clone your repository into your computer (not openwrt/luci).

  3. Make changes
    Make changes you need. At this time, I recommend creating a new branch and working in it.
    git checkout -b <new branch name>

  4. Commit your changes
    Confirm the changes you made and create a commit. You need to include a signature by your real name and email address into the commit, and the commit message must follow the following format. In the case of only the translation changes, there is no problem even if there is no description.

commit title
(blank line)
commit description
(blank line)
Signed-off-by: your realname <your.email@address.com>

And, the commit title must follow the format below.
prefix: summery

In the prefix, write the name of the luci-app or module that made the change.

example:

If you have correctly set your realname and email address by git config, when you open the commit edit screen with the git commit -s command, the signature is automatically inserted.

  1. Push your changes
    Send your changes to your forked GitHub repository.
    git push origin <branch name>

  2. Create a PR in GitHub
    Request openwrt/luci to merge the changes you made.
    In your forked repository page in GitHub, select the branch includes your changes and press "New pull request" button.
    If there is only one commit of changes included in that branch, the title and message in the commit will be automatically reflected in the PR title and message, so after confirming it, press "Create Pull Request" button to create the PR.

1 Like

Thanks, tomorrow I see how it goes.

I think I did it well:

Good work!

There are some things that need to be changed:

  • .mo file is unnecessary, you can drop it from the commit
    • delete the .mo file from the repository
  • In addition to the PR title, the commit title must follow the specified format

Since PR title conforms to this format, it is a good to change the title of commit to the same.

example:

luci-app-travelmate: update Japanese translation                <--- This (first) line is commit title
                                                                <--- blank line
Updated Japanese translations.                                  <--- commit description
                                                                <--- blank line
Signed-off-by: your realname <testmail@address.com>             <--- signature

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
#       modified:   applications/luci-app-travelmate/po/ja/travelmate.po
#

If you make additional changes, reflect them on PR with the following operations.

git add .
git commit --amend
(edit first line (commit title) and save it)
git push -f origin <branch name>

I think I deleted the .mo file, but I'm not sure.