Skip to content

Commit

Permalink
[internal] reorganize localization resources
Browse files Browse the repository at this point in the history
  • Loading branch information
pbatard committed Jul 16, 2018
1 parent 704fd9d commit 0fa19d7
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 164 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ cov-int
cov-int.zip
depcomp
embedded.loc
res/localization/.vs
res/localization/bin
res/localization/obj
res/loc/pollock/.vs
res/loc/pollock/bin
res/loc/pollock/obj
rufus_files
stamp-h1
10 changes: 5 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ PACKAGE_TARNAME='rufus'
PACKAGE_VERSION='3.2'
PACKAGE_STRING='rufus 3.2'
PACKAGE_BUGREPORT='https://github.com/pbatard/rufus/issues'
PACKAGE_URL='https://rufus.akeo.ie'
PACKAGE_URL='https://rufus.ie'

ac_unique_file="src/rufus.c"
ac_subst_vars='am__EXEEXT_FALSE
Expand Down Expand Up @@ -1322,7 +1322,7 @@ Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to <https://github.com/pbatard/rufus/issues>.
rufus home page: <https://rufus.akeo.ie>.
rufus home page: <https://rufus.ie>.
_ACEOF
ac_status=$?
fi
Expand Down Expand Up @@ -3913,7 +3913,7 @@ ac_config_files="$ac_config_files src/libcdio/udf/Makefile"
ac_config_files="$ac_config_files src/libcdio/driver/Makefile"
ac_config_files="$ac_config_files res/localization/Makefile"
ac_config_files="$ac_config_files res/loc/Makefile"
ac_config_files="$ac_config_files src/ms-sys/Makefile"
Expand Down Expand Up @@ -4529,7 +4529,7 @@ Configuration files:
$config_files
Report bugs to <https://github.com/pbatard/rufus/issues>.
rufus home page: <https://rufus.akeo.ie>."
rufus home page: <https://rufus.ie>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
Expand Down Expand Up @@ -4654,7 +4654,7 @@ do
"src/libcdio/iso9660/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/iso9660/Makefile" ;;
"src/libcdio/udf/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/udf/Makefile" ;;
"src/libcdio/driver/Makefile") CONFIG_FILES="$CONFIG_FILES src/libcdio/driver/Makefile" ;;
"res/localization/Makefile") CONFIG_FILES="$CONFIG_FILES res/localization/Makefile" ;;
"res/loc/Makefile") CONFIG_FILES="$CONFIG_FILES res/loc/Makefile" ;;
"src/ms-sys/Makefile") CONFIG_FILES="$CONFIG_FILES src/ms-sys/Makefile" ;;
"src/syslinux/libfat/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libfat/Makefile" ;;
"src/syslinux/libinstaller/Makefile") CONFIG_FILES="$CONFIG_FILES src/syslinux/libinstaller/Makefile" ;;
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([rufus], [3.2], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.akeo.ie])
AC_INIT([rufus], [3.2], [https://github.com/pbatard/rufus/issues], [rufus], [https://rufus.ie])
AM_INIT_AUTOMAKE([-Wno-portability foreign no-dist no-dependencies])
AC_CONFIG_SRCDIR([src/rufus.c])
AC_CONFIG_MACRO_DIR([m4])
Expand Down Expand Up @@ -75,7 +75,7 @@ AC_CONFIG_FILES([src/bled/Makefile])
AC_CONFIG_FILES([src/libcdio/iso9660/Makefile])
AC_CONFIG_FILES([src/libcdio/udf/Makefile])
AC_CONFIG_FILES([src/libcdio/driver/Makefile])
AC_CONFIG_FILES([res/localization/Makefile])
AC_CONFIG_FILES([res/loc/Makefile])
AC_CONFIG_FILES([src/ms-sys/Makefile])
AC_CONFIG_FILES([src/syslinux/libfat/Makefile])
AC_CONFIG_FILES([src/syslinux/libinstaller/Makefile])
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions res/localization/Makefile.in → res/loc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
noinst_PROGRAMS =
subdir = res/localization
subdir = res/loc
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
Expand Down Expand Up @@ -216,9 +216,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps res/localization/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps res/loc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign --ignore-deps res/localization/Makefile
$(AUTOMAKE) --foreign --ignore-deps res/loc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
Expand Down
File renamed without changes.
29 changes: 23 additions & 6 deletions res/localization/Pollock.cs → res/loc/pollock/Pollock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ static List<Language> ParseLocFile(string file, string select_id = null)
}
lang.sections[section_name].Add(new Message(parts[1], parts[2]));
// We also maintain global list of Id -> str for convenience
// TODO: This lookup BREAKS on multiline!!
lang.id_to_str.Add(new Id(section_name, (parts[1])), parts[2]);
last_key = parts[1];
if (comment != null)
Expand Down Expand Up @@ -655,7 +654,23 @@ static bool UpdateLocFile(Language lang, string path = null)
bool skip = false;
foreach (var line in lines)
{
if (line.StartsWith($"l \"{lang.id}\""))
if (line.StartsWith($"# • v"))
{
var parts = line.Split('"');
if (parts.Count() < 2)
{
writer.WriteLine(line);
continue;
}
if (parts[1] != lang.id)
{
writer.WriteLine(line);
continue;
}
writer.WriteLine($"# • v{lang.version,-4} \"{lang.id}\" \"{lang.name}\"");
continue;
}
else if (line.StartsWith($"l \"{lang.id}\""))
{
skip = true;
WriteLoc(writer, lang);
Expand Down Expand Up @@ -702,7 +717,7 @@ static bool SaveLocFile(List<Language> list, string path = null)
writer.WriteLine("# List of all languages included in this file (with version)");
foreach (var lang in list)
{
writer.WriteLine($"# • v{lang.version} \"{lang.id}\" \"{lang.name}\"");
writer.WriteLine($"# • v{lang.version, -4} \"{lang.id}\" \"{lang.name}\"");
}
foreach (var lang in list)
{
Expand Down Expand Up @@ -955,7 +970,7 @@ static void Main(string[] args)
if (AppDomain.CurrentDomain.FriendlyName.Contains('m'))
goto Maintainer_Mode;

string loc_url = "https://github.com/pbatard/rufus/raw/master/res/localization/rufus.loc";
string loc_url = "https://github.com/pbatard/rufus/raw/master/res/loc/rufus.loc";
string ver_url = "https://rufus.ie/Loc.ver";
string rufus_url = null;
string rufus_file = null;
Expand Down Expand Up @@ -1123,7 +1138,9 @@ static void Main(string[] args)
goto Exit;
}
var sha = str.Substring(str.IndexOf("/pbatard/rufus/commit/") + 22, 40);
url = "https://github.com/pbatard/rufus/raw/" + sha + "/res/localization/rufus.loc";
// TODO: Remove this once everyone has upgraded past 3.2
string loc_dir = ((list[index][2][0] == '2') || ((list[index][2][0] == '3') && (list[index][2][2] == '0'))) ? "localization" : "loc";
url = "https://github.com/pbatard/rufus/raw/" + sha + "/res/" + loc_dir + "/rufus.loc";
if (!DownloadFile(url, old_loc_file))
{
index = -1;
Expand Down Expand Up @@ -1219,7 +1236,7 @@ static void Main(string[] args)
file_dialog.ShowDialog();
file_name = file_dialog.FileName;
Console.WriteLine(file_name);
// TODO: fetch the .loc one directory up if we reorganize our loc dir to have loc\po
// TODO: Fetch the .loc one directory up if we reorganize our loc dir to have loc\po
UpdateLocFile(ParsePoFile(file_name));
WaitForKey("Press any key to exit...");
}
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0fa19d7

Please sign in to comment.