question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a danish locale for luci-base

See original GitHub issue

I think it would be really easy to add a danish locale to the base, just copy the norwegian base.po and correct the minor differences.

Would this work, If I just copy it and add the setting like this?

NEW=da
BASE=no
cp -a packages/luci/modules/luci-base/po/$BASE/ packages/luci/modules/luci-base/po/$NEW/
sed -i 's/Language: $BASE/Language: $NEW/g' packages/luci/modules/luci-base/po/$NEW/base.po

And add this line manually in gluon/packages/luci/luci.mk:

LUCI_LANG.da=Dansk (Danish)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hnymancommented, Sep 1, 2016

That looks almost ok to me. Just some technical comments and advice:

  • In luci.mk, the new “Danish” line should be before “Deutsch”, not after. da<de
  • In two of the .po files, you have left the dates & names of the last Norwegian translator. Please remove those or even better, place your own info there…
  • Remember that the commit message (the git commit message itself, not the PR) should be “signed off by” properly by you. Read https://github.com/openwrt/luci/blob/master/CONTRIBUTING.md
  • If you commit the editing to your local repo in several separate commits, please squash them together with git rebase -i HEAD~6 etc. so that there is just one commit, before you create the PR. Some advice in CONTRIBUTING.md.
  • It pays off to have a separate local git branch for the work. Then you can easily do the possibly needed editing to the PR (even after sending the PR).

I suggest that after editing the .po files, but before committing them, you run from the Luci repo’s root directory the command ./build/i18n-sync.sh. That will straighten up e.g. the line wraps of multiline strings, as the line lengths may have changed.

1reaction
hnymancommented, Aug 29, 2016

One additional piece of advice how to add a new language to Luci. It is not really documented anywhere and it is a bit tricky to get “make menuconfig” and/or “make defconfig” to recognise the new language packages, as the language packages are designed to be hidden:

  1. Add new LUCI_LANG definition to luci.mk . For example “fi” for Finnish:
 LUCI_LANG.fi=Suomi (Finnish)
  1. Initialise translation for luci-base. Go to the “po” directory and create a dir for the new language.
cd modules/luci-base/po
mkdir fi
msginit -o fi/base.po -i templates/base.pot -l fi

(It is also possible to copy the .po file from a similar language to speed up the translation, as long as you edit the header info to reflect the correct language. e.g, using Norwegian for Danish might work)

  1. Update the packages and the index, and install the packages. This lays the foundation for menuconfig to find the new language and the new luci-i18n-base-fi package. First remove the existing index and its tmp files, then update things.
rm feeds/luci.index
rm -rf feeds/luci.tmp
./scripts/feeds update
./scripts/feeds install -a
  1. Clear the config system’s cache. This is the tricky step and can be easily forgotten as it is not that obvious. “make dirclean” takes care of this, but a more lightweight alternative is to just delete the “tmp” directory with “rm -rf tmp” in the buildroot.
rm -rf tmp

And now make menuconfig should find the new language.

I struggled a long time myself before I figured out that last step. As long as there are old tmp/info/.packageinfo-feeds_luci_luci-* files, the new language packages will not show up in menuconfig.

Read more comments on GitHub >

github_iconTop Results From Across the Web

da_DK - Locale Helper
Locale Helper. Ease creation and maintenance of glibc locale files. Danish - DENMARK (DK) (da_DK). 100% ...
Read more >
Adding or Removing Locales by Using nlsadm
You can use the install-locale , list-locale , and uninstall-locale ... For example, to install the Danish locale, you would use the following...
Read more >
Build environment not working - General discussion
warning: 4 lines add whitespace errors. ... Applying: luci-base: Add webapps configuration ... Installing package 'danish' from packages
Read more >
https://downloads.openwrt.org/releases/19.07.8/pac...
It also automatically adds the required libavahi-client package. ... graph-parallel - iostreams - locale (Requires kernel being compiled with full language ...
Read more >
Understanding Locale
Locale Language Country Code Set Ar_AA Arabic Arabic Countries IBM‑1046 ar_AA Arabic Arabic Countries IS08859‑6 be_BY Byelorussian Belarus ISO8859‑5
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found